ParticleCollectionBuilder Namespace

Function

Name Description
ParticleCollectionBuilder.create Creates a new ParticleCollectionBuilder.

Defined in

ParticleCollectionBuilder Interface

Interface for producing a collection of particles suitable for use in particle effects. Particle effects involve animating hundreds or thousands of small particles to simulate phenomena like smoke, fire, snow, etc. A particle collection represents each particle as a quad (rectangle) displaying an image. The position of each particle corresponds to the centroid of its quad. The transparency and size of each particle can be specified individually. By default, the quads will always rotate to face the camera such that the image is fully visible.

Creating a particle collection using a ParticleCollectionBuilder is far more efficient (in both CPU and GPU usage) than doing so using a GraphicBuilder.

@see - interactive demonstrations of Snow and Rain and

Properties

Name Type Description
addParticle (particle: ParticleProps) => void Add a particle to the collection.  
finish () => undefined | RenderGraphic Produces a finished graphic from the accumulated particles.  
size Readonly<WritableXAndY> The default size of each particle, used by addParticle if ParticleProps.size is omitted.  
transparency number The default transparency for newly-added particles as an integer in [0,255], used by addParticle if transparency is omitted.  

Defined in

Last Updated: 17 July, 2024