import Container from "./../renderable/container.js"; import CanvasRenderTarget from "../video/rendertarget/canvasrendertarget.js"; /** * Particle Emitter Object. * @category Particles */ export default class ParticleEmitter extends Container { /** * the current (active) emitter settings */ settings: Record; /** @ignore */ _stream: boolean; /** @ignore */ _frequencyTimer: number; /** @ignore */ _durationTimer: number; /** @ignore */ _enabled: boolean; /** @ignore */ _updateCount: number; /** @ignore */ _dt: number; /** @ignore */ _defaultParticle: CanvasRenderTarget | undefined; /** * @param x - x position of the particle emitter * @param y - y position of the particle emitter * @param [settings=ParticleEmitterSettings] - the settings for the particle emitter. * @example * // Create a particle emitter at position 100, 100 * let emitter = new ParticleEmitter(100, 100, { * width: 16, * height : 16, * tint: "#f00", * totalParticles: 32, * angle: 0, * angleVariation: 6.283185307179586, * maxLife: 5, * speed: 3 * }); * * // Add the emitter to the game world * app.world.addChild(emitter); * * // Launch all particles one time and stop, like an explosion * emitter.burstParticles(); * * // Launch constantly the particles, like a fountain * emitter.streamParticles(); * * // At the end, remove emitter from the game world * // call this in onDestroyEvent function * app.world.removeChild(emitter); */ constructor(x: number, y: number, settings?: Record); /** * Reset the emitter with particle emitter settings. * @param settings - [optional] object with emitter settings. See {@link ParticleEmitterSettings} */ reset(settings?: Record): void; /** * returns a random point on the x axis within the bounds of this emitter * @returns a random x position within the emitter bounds */ getRandomPointX(): number; /** * returns a random point on the y axis within the bounds this emitter * @returns a random y position within the emitter bounds */ getRandomPointY(): number; /** @ignore */ addParticles(count: number): void; /** * Emitter is of type stream and is launching particles * @returns Emitter is Stream and is launching particles */ isRunning(): boolean; /** * Launch particles from emitter constantly (e.g. for stream) * @param [duration] - time that the emitter releases particles in ms */ streamParticles(duration?: number): void; /** * Stop the emitter from generating new particles (used only if emitter is Stream) */ stopStream(): void; /** * Launch all particles from emitter and stop (e.g. for explosion) * @param [total] - number of particles to launch */ burstParticles(total?: number): void; /** * @ignore */ update(dt: number): boolean; /** * Destroy function * @ignore */ destroy(): void; } //# sourceMappingURL=emitter.d.ts.map