-
-
Notifications
You must be signed in to change notification settings - Fork 94
Particles
Marc Flerackers edited this page Mar 23, 2025
·
5 revisions
Particles is now finished, so the information may no longer be up-to-date.
Particles is a component so that transformation can be optimized and all particles can be drawn at once.
Particles has options for the emitter and the particles. The emitter decides where, how and when particles are emitted. An emitter can emit particles periodically or instantly using the emit command. Once emitted, the particle options will decide how the particle looks, moves and how long it lives.
export type ParticlesOpt = {
maxParticles: number;
emitterShape?: ShapeType;
emitterLifetime?: number;
emissionRate: number;
emissionDirection: number;
emissionSpread: number;
particleLifeTime: [number, number];
particleSpeed: [number, number];
particleColors?: Color[];
particleOpacities?: number[];
particleSprites?: string[];
};
export interface ParticlesComp extends Comp {
emit(n: number): void;
onEnd(cb: () => void): void;
}
export function particles(opt: ParticlesOpt): ParticlesCompIf needed a separate emitter component can be made to emit particles as objects. However this will have worse performance and as such should not be encouraged.
