UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

74 lines 2.76 kB
import Texture from "../textures/Texture"; import MeshStyle from "../styles/MeshStyle"; import Painter from "../rendering/Painter"; import Mesh from "../display/Mesh"; import DisplayObject from "../display/DisplayObject"; import IAnimatable from "../animation/IAnimatable"; import Rectangle from "openfl/geom/Rectangle"; import Point from "openfl/geom/Point"; import Context3DBlendFactor from "openfl/display3D/Context3DBlendFactor"; declare namespace starling.extensions { /** * Dispatched when emission of particles is finished. */ export class ParticleSystem extends Mesh implements IAnimatable { constructor(texture?: Texture); static readonly MAX_NUM_PARTICLES = 16383; /** * @inheritDoc */ override dispose(): void; /** * Always returns <code>null</code>. An actual test would be too expensive. */ override hitTest(localPoint: Point): DisplayObject; /** * Starts the emitter for a certain time. @default infinite time */ start(duration?: number): void; /** * Stops emitting new particles. Depending on 'clearParticles', the existing particles * * will either keep animating until they die or will be removed right away. */ stop(clearParticles?: boolean): void; /** * Removes all currently active particles. */ clear(): void; /** * Returns an empty rectangle at the particle system's position. Calculating the * * actual bounds would be too expensive. */ override getBounds(targetSpace: DisplayObject, resultRect?: Rectangle): Rectangle; advanceTime(passedTime: number): void; override render(painter: Painter): void; /** * Initialize the <code>ParticleSystem</code> with particles distributed randomly * * throughout their lifespans. */ populate(count: number): void; get capacity(): number; set capacity(value: number) get isEmitting(): boolean; get numParticles(): number; get emissionRate(): number; set emissionRate(value: number) get emitterX(): number; set emitterX(value: number) get emitterY(): number; set emitterY(value: number) get blendFactorSource(): Context3DBlendFactor; set blendFactorSource(value: Context3DBlendFactor) get blendFactorDestination(): Context3DBlendFactor; set blendFactorDestination(value: Context3DBlendFactor) override setStyle(meshStyle?: MeshStyle, mergeWithPredecessor?: boolean): void; /** * Indicates if this object will be added to the painter's batch on rendering, * * or if it will draw itself right away. Note that this should only be enabled if the * * number of particles is reasonably small. */ get batchable(): boolean; set batchable(value: boolean) } } export default starling.extensions.ParticleSystem;