pixijs-scene-particle-container

安装量: 820
排名: #4816

安装

npx skills add https://github.com/pixijs/pixijs-skills --skill pixijs-scene-particle-container

ParticleContainer is a specialized container for rendering hundreds to tens of thousands of lightweight sprites in a single draw call. Use it for particle effects, bullet patterns, or any case where you need a large number of similar-looking objects with minimal per-object overhead. Particles share a single base texture and have a restricted transform set; they are not full Container children. Assumes familiarity with pixijs-scene-core-concepts . ParticleContainer is a special leaf in a different sense: it contains Particle instances in its own particleChildren array and rejects normal PixiJS children. Use addParticle , not addChild , and wrap the whole ParticleContainer in a Container if you need to group it with other scene objects. The Particle API is new in v8 but is stable for production use. Quick Start const texture = await Assets . load ( "particle.png" ) ; const container = new ParticleContainer ( { texture , boundsArea : new Rectangle ( 0 , 0 , app . screen . width , app . screen . height ) , dynamicProperties : { position : true , rotation : false , color : false , } , } ) ; for ( let i = 0 ; i < 10000 ; i ++ ) { container . addParticle ( new Particle ( { texture , x : Math . random ( ) * app . screen . width , y : Math . random ( ) * app . screen . height , } ) , ) ; } app . stage . addChild ( container ) ;

返回排行榜