import { type PointLike, Rectangle, Texture } from 'pixi.js'
import { For, Suspense } from 'solid-js'
} from '../../../../solid-pixi/src/index'
const parent = useParent()
const app = useApplication()
const texture = Texture.from('https://pixijs.com/assets/eggHead.png')
const dudes = Array.from({ length: 20 }).map(() => {
const scale = 0.8 + Math.random() * 0.3
direction: Math.random() * Math.PI * 2,
x: Math.random() * app!.screen.width,
y: Math.random() * app!.screen.height,
turningSpeed: Math.random() - 0.8,
speed: 2 + Math.random() * 2,
tint: Math.random() * 0xffffff,
scale: { x: scale, y: scale }
const dudeBoundsPadding = 100
const dudeBounds = new Rectangle(
app!.screen.width + dudeBoundsPadding * 2,
app!.screen.height + dudeBoundsPadding * 2
for (let i = 0; i < parent.children.length; i++) {
const dude = parent.children[i] as ExtendedSprite<{
const newDirection = dude.direction + dude.turningSpeed * 0.01
dude.direction = newDirection
dude.x += Math.sin(dude.direction) * dude.speed
dude.y += Math.cos(dude.direction) * dude.speed
dude.rotation = -newDirection - Math.PI / 2
if (dude.x < dudeBounds.x) {
dude.x += dudeBounds.width
} else if (dude.x > dudeBounds.x + dudeBounds.width) {
dude.x -= dudeBounds.width
if (dude.y < dudeBounds.y) {
dude.y += dudeBounds.height
} else if (dude.y > dudeBounds.y + dudeBounds.height) {
dude.y -= dudeBounds.height
<Sprite<{ speed: number; direction: number; turningSpeed: number }>
anchor={{ x: 0.5, y: 0.5 } as PointLike}
direction={dude.direction}
turningSpeed={dude.turningSpeed}
const app = useApplication()
texture={Texture.from('https://pixijs.com/assets/bg_rotate.jpg')}
height={app?.stage.height}
export function BlendModes() {
<Application resizeTo={window}>
['https://pixijs.com/assets/eggHead.png', 'https://pixijs.com/assets/bg_rotate.jpg']