/** * Creates a new Particle Emitter Game Object and adds it to the Scene. * * If you wish to configure the Emitter after creating it, use the `ParticleEmitter.setConfig` method. * * Prior to Phaser v3.60 this function would create a `ParticleEmitterManager`. These were removed * in v3.60 and replaced with creating a `ParticleEmitter` instance directly. Please see the * updated function parameters and class documentation for more details. * * Note: This method will only be available if the Particles Game Object has been built into Phaser. * @param x The horizontal position of this Game Object in the world. * @param y The vertical position of this Game Object in the world. * @param texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. * @param config Configuration settings for the Particle Emitter. */ particles(x?: number, y?: number, texture?: string | Phaser.Textures.Texture, config?: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig): Phaser.GameObjects.Particles.ParticleEmitter; class ParticleEmitter extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.PostPipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Texture, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible { /** * * @param config Settings for this emitter. */ constructor(config: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig); /** * The Particle Class which will be emitted by this Emitter. */ particleClass: Function; /** * An internal object holding all of the EmitterOp instances. * * These are populated as part of the Emitter configuration parsing. * * You typically do not access them directly, but instead use the * provided getters and setters on this class, such as `ParticleEmitter.speedX` etc. */ ops: Phaser.Types.GameObjects.Particles.ParticleEmitterOps; /** * A radial emitter will emit particles in all directions between angle min and max, * using {@link Phaser.GameObjects.Particles.ParticleEmitter#speed} as the value. If set to false then this acts as a point Emitter. * A point emitter will emit particles only in the direction derived from the speedX and speedY values. */ radial: boolean; /** * Horizontal acceleration applied to emitted particles, in pixels per second squared. */ gravityX: number; /** * Vertical acceleration applied to emitted particles, in pixels per second squared. */ gravityY: number; /** * Whether accelerationX and accelerationY are non-zero. Set automatically during configuration. */ acceleration: boolean; /** * Whether moveToX and moveToY are set. Set automatically during configuration. * * When true the particles move toward the moveToX and moveToY coordinates and arrive at the end of their life. * Emitter angle, speedX, and speedY are ignored. */ moveTo: boolean; /** * A function to call when a particle is emitted. */ emitCallback: Phaser.Types.GameObjects.Particles.ParticleEmitterCallback | null; /** * The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallback}. */ emitCallbackScope: any | null; /** * A function to call when a particle dies. */ deathCallback: Phaser.Types.GameObjects.Particles.ParticleDeathCallback | null; /** * The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallback}. */ deathCallbackScope: any | null; /** * Set to hard limit the amount of particle objects this emitter is allowed to create * in total. This is the number of `Particle` instances it can create, not the number * of 'alive' particles. * * 0 means unlimited. */ maxParticles: number; /** * The maximum number of alive and rendering particles this emitter will update. * When this limit is reached, a particle needs to die before another can be emitted. * * 0 means no limits. */ maxAliveParticles: number; /** * If set, either via the Emitter config, or by directly setting this property, * the Particle Emitter will stop emitting particles once this total has been * reached. It will then enter a 'stopped' state, firing the `STOP` * event. Note that entering a stopped state doesn't mean all the particles * have finished, just that it's not emitting any further ones. * * To know when the final particle expires, listen for the COMPLETE event. * * Use this if you wish to launch an exact number of particles and then stop * your emitter afterwards. * * The counter is reset each time the `ParticleEmitter.start` method is called. * * 0 means the emitter will not stop based on total emitted particles. */ stopAfter: number; /** * The number of milliseconds this emitter will emit particles for when in flow mode, * before it stops emission. A value of 0 (the default) means there is no duration. * * When the duration expires the `STOP` event is emitted. Note that entering a * stopped state doesn't mean all the particles have finished, just that it's * not emitting any further ones. * * To know when the final particle expires, listen for the COMPLETE event. * * The counter is reset each time the `ParticleEmitter.start` method is called. * * 0 means the emitter will not stop based on duration. */ duration: number; /** * For a flow emitter, the time interval (>= 0) between particle flow cycles in ms. * A value of 0 means there is one particle flow cycle for each logic update (the maximum flow frequency). This is the default setting. * For an exploding emitter, this value will be -1. * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} also puts the emitter in flow mode (frequency >= 0). * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} also puts the emitter in explode mode (frequency = -1). */ frequency: number; /** * Controls if the emitter is currently emitting a particle flow (when frequency >= 0). * * Already alive particles will continue to update until they expire. * * Controlled by {@link Phaser.GameObjects.Particles.ParticleEmitter#start} and {@link Phaser.GameObjects.Particles.ParticleEmitter#stop}. */ emitting: boolean; /** * Newly emitted particles are added to the top of the particle list, i.e. rendered above those already alive. * * Set to false to send them to the back. * * Also see the `sortOrder` property for more complex particle sorting. */ particleBringToTop: boolean; /** * The time rate applied to active particles, affecting lifespan, movement, and tweens. Values larger than 1 are faster than normal. */ timeScale: number; /** * An array containing Particle Emission Zones. These can be either EdgeZones or RandomZones. * * Particles are emitted from a randomly selected zone from this array. * * Prior to Phaser v3.60 an Emitter could only have one single Emission Zone. * In 3.60 they can now have an array of Emission Zones. */ emitZones: Phaser.GameObjects.Particles.Zones.EdgeZone[] | Phaser.GameObjects.Particles.Zones.RandomZone[]; /** * An array containing Particle Death Zone objects. A particle is immediately killed as soon as its x/y coordinates * intersect with any of the configured Death Zones. * * Prior to Phaser v3.60 an Emitter could only have one single Death Zone. * In 3.60 they can now have an array of Death Zones. */ deathZones: Phaser.GameObjects.Particles.Zones.DeathZone[]; /** * An optional Rectangle object that is used during rendering to cull Particles from * display. For example, if your particles are limited to only move within a 300x300 * sized area from their origin, then you can set this Rectangle to those dimensions. * * The renderer will check to see if the `viewBounds` Rectangle intersects with the * Camera bounds during the render step and if not it will skip rendering the Emitter * entirely. * * This allows you to create many emitters in a Scene without the cost of * rendering if the contents aren't visible. * * Note that the Emitter will not perform any checks to see if the Particles themselves * are outside of these bounds, or not. It will simply check the bounds against the * camera. Use the `getBounds` method with the `advance` parameter to help define * the location and placement of the view bounds. */ viewBounds: Phaser.Geom.Rectangle | null; /** * A Game Object whose position is used as the particle origin. */ follow: Phaser.GameObjects.GameObject | null; /** * The offset of the particle origin from the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target. */ followOffset: Phaser.Math.Vector2; /** * Whether the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#visible} state will track * the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target's visibility state. */ trackVisible: boolean; /** * The texture frames assigned to particles. */ frames: Phaser.Textures.Frame[]; /** * Whether texture {@link Phaser.GameObjects.Particles.ParticleEmitter#frames} are selected at random. */ randomFrame: boolean; /** * The number of consecutive particles that receive a single texture frame (per frame cycle). */ frameQuantity: number; /** * The animations assigned to particles. */ anims: string[]; /** * Whether animations {@link Phaser.GameObjects.Particles.ParticleEmitter#anims} are selected at random. */ randomAnim: boolean; /** * The number of consecutive particles that receive a single animation (per frame cycle). */ animQuantity: number; /** * An internal property used to tell when the emitter is in fast-forwarc mode. */ skipping: boolean; /** * An internal Transform Matrix used to cache this emitters world matrix. */ worldMatrix: Phaser.GameObjects.Components.TransformMatrix; /** * Optionally sort the particles before they render based on this * property. The property must exist on the `Particle` class, such * as `y`, `lifeT`, `scaleX`, etc. * * When set this overrides the `particleBringToTop` setting. * * To reset this and disable sorting, so this property to an empty string. */ sortProperty: string; /** * When `sortProperty` is defined this controls the sorting order, * either ascending or descending. Toggle to control the visual effect. */ sortOrderAsc: boolean; /** * The callback used to sort the particles. Only used if `sortProperty` * has been set. Set this via the `setSortCallback` method. */ sortCallback: Phaser.Types.GameObjects.Particles.ParticleSortCallback | null; /** * A list of Particle Processors being managed by this Emitter. */ processors: Phaser.Structs.List<Phaser.GameObjects.Particles.ParticleProcessor>; /** * The tint fill mode used by the Particles in this Emitter. * * `false` = An additive tint (the default), where vertices colors are blended with the texture. * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. */ tintFill: boolean; /** * Takes an Emitter Configuration file and resets this Emitter, using any * properties defined in the config to then set it up again. * @param config Settings for this emitter. */ setConfig(config: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig): this; /** * Creates a description of this emitter suitable for JSON serialization. */ toJSON(): Phaser.Types.GameObjects.JSONGameObject; /** * Resets the internal counter trackers. * * You shouldn't ever need to call this directly. * @param frequency The frequency counter. * @param on Set the complete flag. */ resetCounters(frequency: number, on: boolean): void; /** * Continuously moves the particle origin to follow a Game Object's position. * @param target The Game Object to follow. * @param offsetX Horizontal offset of the particle origin from the Game Object. Default 0. * @param offsetY Vertical offset of the particle origin from the Game Object. Default 0. * @param trackVisible Whether the emitter's visible state will track the target's visible state. Default false. */ startFollow(target: Phaser.GameObjects.GameObject, offsetX?: number, offsetY?: number, trackVisible?: boolean): this; /** * Stops following a Game Object. */ stopFollow(): this; /** * Chooses a texture frame from {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. */ getFrame(): Phaser.Textures.Frame; /** * Sets a pattern for assigning texture frames to emitted particles. The `frames` configuration can be any of: * * frame: 0 * frame: 'red' * frame: [ 0, 1, 2, 3 ] * frame: [ 'red', 'green', 'blue', 'pink', 'white' ] * frame: { frames: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] } * @param frames One or more texture frames, or a configuration object. * @param pickRandom Whether frames should be assigned at random from `frames`. Default true. * @param quantity The number of consecutive particles that will receive each frame. Default 1. */ setEmitterFrame(frames: any[] | string | number | Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig, pickRandom?: boolean, quantity?: number): this; /** * Chooses an animation from {@link Phaser.GameObjects.Particles.ParticleEmitter#anims}, if populated. */ getAnim(): string; /** * Sets a pattern for assigning animations to emitted particles. The `anims` configuration can be any of: * * anim: 'red' * anim: [ 'red', 'green', 'blue', 'pink', 'white' ] * anim: { anims: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] } * @param anims One or more animations, or a configuration object. * @param pickRandom Whether animations should be assigned at random from `anims`. Default true. * @param quantity The number of consecutive particles that will receive each animation. Default 1. */ setAnim(anims: any[] | string | Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig, pickRandom?: boolean, quantity?: number): this; /** * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle movement on or off. * @param value Radial mode (true) or point mode (true). Default true. */ setRadial(value?: boolean): this; /** * Creates a Particle Bounds processor and adds it to this Emitter. * * This processor will check to see if any of the active Particles hit * the defined boundary, as specified by a Rectangle shape in world-space. * * If so, they are 'rebounded' back again by having their velocity adjusted. * * The strength of the rebound is controlled by the `Particle.bounce` * property. * * You should be careful to ensure that you emit particles within a bounds, * if set, otherwise it will lead to unpredictable visual results as the * particles are hastily repositioned. * * The Particle Bounds processor is returned from this method. If you wish * to modify the area you can directly change its `bounds` property, along * with the `collideLeft` etc values. * * To disable the bounds you can either set its `active` property to `false`, * or if you no longer require it, call `ParticleEmitter.removeParticleProcessor`. * @param x The x-coordinate of the left edge of the boundary, or an object representing a rectangle. * @param y The y-coordinate of the top edge of the boundary. * @param width The width of the boundary. * @param height The height of the boundary. * @param collideLeft Whether particles interact with the left edge of the bounds. Default true. * @param collideRight Whether particles interact with the right edge of the bounds. Default true. * @param collideTop Whether particles interact with the top edge of the bounds. Default true. * @param collideBottom Whether particles interact with the bottom edge of the bounds. Default true. */ addParticleBounds(x: number | Phaser.Types.GameObjects.Particles.ParticleEmitterBounds | Phaser.Types.GameObjects.Particles.ParticleEmitterBoundsAlt, y?: number, width?: number, height?: number, collideLeft?: boolean, collideRight?: boolean, collideTop?: boolean, collideBottom?: boolean): Phaser.GameObjects.Particles.ParticleBounds; /** * Sets the initial radial speed of emitted particles. * * Changes the emitter to radial mode. * @param x The horizontal speed of the emitted Particles. * @param y The vertical speed of emitted Particles. If not set it will use the `x` value. Default x. */ setParticleSpeed(x: number, y?: number): this; /** * Sets the vertical and horizontal scale of the emitted particles. * * You can also set the scale of the entire emitter via `setScale`. * @param x The horizontal scale of the emitted Particles. Default 1. * @param y The vertical scale of emitted Particles. If not set it will use the `x` value. Default x. */ setParticleScale(x?: number, y?: number): this; /** * Sets the gravity applied to emitted particles. * @param x Horizontal acceleration due to gravity, in pixels per second squared. Set to zero for no gravity. * @param y Vertical acceleration due to gravity, in pixels per second squared. Set to zero for no gravity. */ setParticleGravity(x: number, y: number): this; /** * Sets the opacity (alpha) of emitted particles. * * You can also set the alpha of the entire emitter via `setAlpha`. * @param value A value between 0 (transparent) and 1 (opaque). */ setParticleAlpha(value: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType): this; /** * Sets the color tint of emitted particles. * * This is a WebGL only feature. * @param value A value between 0 and 0xffffff. */ setParticleTint(value: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType): this; /** * Sets the angle of a {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle stream. * * The value is given in degrees using Phaser's right-handed coordinate system. * @param value The angle of the initial velocity of emitted particles, in degrees. */ setEmitterAngle(value: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType): this; /** * Sets the lifespan of newly emitted particles in milliseconds. * @param value The lifespan of a particle, in ms. */ setParticleLifespan(value: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType): this; /** * Sets the number of particles released at each flow cycle or explosion. * @param quantity The number of particles to release at each flow cycle or explosion. */ setQuantity(quantity: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType): this; /** * Sets the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#frequency} * and {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. * @param frequency The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode. * @param quantity The number of particles to release at each flow cycle or explosion. */ setFrequency(frequency: number, quantity?: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType): this; /** * Adds a new Particle Death Zone to this Emitter. * * A particle is immediately killed as soon as its x/y coordinates intersect * with any of the configured Death Zones. * * The `source` can be a Geometry Shape, such as a Circle, Rectangle or Triangle. * Any valid object from the `Phaser.Geometry` namespace is allowed, as long as * it supports a `contains` function. You can set the `type` to be either `onEnter` * or `onLeave`. * * A single Death Zone instance can only exist once within this Emitter, but can belong * to multiple Emitters. * @param config A Death Zone configuration object, a Death Zone instance, a valid Geometry object or an array of them. */ addDeathZone(config: Phaser.Types.GameObjects.Particles.DeathZoneObject | Phaser.Types.GameObjects.Particles.DeathZoneObject[]): Phaser.GameObjects.Particles.Zones.DeathZone; /** * Removes the given Particle Death Zone from this Emitter. * @param zone The Death Zone that should be removed from this Emitter. */ removeDeathZone(zone: Phaser.GameObjects.Particles.Zones.DeathZone): this; /** * Adds a new Particle Emission Zone to this Emitter. * * An {@link Phaser.Types.GameObjects.Particles.ParticleEmitterEdgeZoneConfig EdgeZone} places particles on its edges. * Its {@link Phaser.Types.GameObjects.Particles.EdgeZoneSource source} can be a Curve, Path, Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; * or any object with a suitable {@link Phaser.Types.GameObjects.Particles.EdgeZoneSourceCallback getPoints} method. * * A {@link Phaser.Types.GameObjects.Particles.ParticleEmitterRandomZoneConfig RandomZone} places the particles randomly within its interior. * Its {@link RandomZoneSource source} can be a Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link Phaser.Types.GameObjects.Particles.RandomZoneSourceCallback getRandomPoint} method. * * An Emission Zone can only exist once within this Emitter. * @param zone An Emission Zone configuration object, a RandomZone or EdgeZone instance, or an array of them. */ addEmitZone(zone: Phaser.Types.GameObjects.Particles.EmitZoneObject | Phaser.Types.GameObjects.Particles.EmitZoneObject[]): Phaser.GameObjects.Particles.Zones.EdgeZone[] | Phaser.GameObjects.Particles.Zones.RandomZone[]; /** * Removes the given Particle Emission Zone from this Emitter. * @param zone The Emission Zone that should be removed from this Emitter. */ removeEmitZone(zone: Phaser.GameObjects.Particles.Zones.EdgeZone | Phaser.GameObjects.Particles.Zones.RandomZone): this; /** * Takes the given particle and sets its x/y coordinates to match the next available * emission zone, if any have been configured. This method is called automatically * as part of the `Particle.fire` process. * * The Emit Zones are iterated in sequence. Once a zone has had a particle emitted * from it, then the next zone is used and so on, in a loop. * @param particle The particle to set the emission zone for. */ getEmitZone(particle: Phaser.GameObjects.Particles.Particle): void; /** * Takes the given particle and checks to see if any of the configured Death Zones * will kill it and returns the result. This method is called automatically as part * of the `Particle.update` process. * @param particle The particle to test against the Death Zones. */ getDeathZone(particle: Phaser.GameObjects.Particles.Particle): boolean; /** * Changes the currently active Emission Zone. The zones should have already * been added to this Emitter either via the emitter config, or the * `addEmitZone` method. * * Call this method by passing either a numeric zone index value, or * the zone instance itself. * * Prior to v3.60 an Emitter could only have a single Emit Zone and this * method was how you set it. From 3.60 and up it now performs a different * function and swaps between all available active zones. * @param zone The Emit Zone to set as the active zone. */ setEmitZone(zone: number | Phaser.GameObjects.Particles.Zones.EdgeZone | Phaser.GameObjects.Particles.Zones.RandomZone): this; /** * Adds a Particle Processor, such as a Gravity Well, to this Emitter. * * It will start processing particles from the next update as long as its `active` * property is set. * @param processor The Particle Processor to add to this Emitter Manager. */ addParticleProcessor<T extends Phaser.GameObjects.Particles.ParticleProcessor>(processor: T): T; /** * Removes a Particle Processor from this Emitter. * * The Processor must belong to this Emitter to be removed. * * It is not destroyed when removed, allowing you to move it to another Emitter Manager, * so if you no longer require it you should call its `destroy` method directly. * @param processor The Particle Processor to remove from this Emitter Manager. */ removeParticleProcessor<T extends Phaser.GameObjects.Particles.ParticleProcessor>(processor: T): T | null; /** * Gets all active Particle Processors. */ getProcessors(): Phaser.GameObjects.Particles.ParticleProcessor[]; /** * Creates a new Gravity Well, adds it to this Emitter and returns a reference to it. * @param config Configuration settings for the Gravity Well to create. */ createGravityWell(config: Phaser.Types.GameObjects.Particles.GravityWellConfig): Phaser.GameObjects.Particles.GravityWell; /** * Creates inactive particles and adds them to this emitter's pool. * * If `ParticleEmitter.maxParticles` is set it will limit the * value passed to this method to make sure it's not exceeded. * @param count The number of particles to create. */ reserve(count: number): this; /** * Gets the number of active (in-use) particles in this emitter. */ getAliveParticleCount(): number; /** * Gets the number of inactive (available) particles in this emitter. */ getDeadParticleCount(): number; /** * Gets the total number of particles in this emitter. */ getParticleCount(): number; /** * Whether this emitter is at either its hard-cap limit (maxParticles), if set, or * the max allowed number of 'alive' particles (maxAliveParticles). */ atLimit(): boolean; /** * Sets a function to call for each newly emitted particle. * @param callback The function. * @param context The calling context. */ onParticleEmit(callback: Phaser.Types.GameObjects.Particles.ParticleEmitterCallback, context?: any): this; /** * Sets a function to call for each particle death. * @param callback The function. * @param context The function's calling context. */ onParticleDeath(callback: Phaser.Types.GameObjects.Particles.ParticleDeathCallback, context?: any): this; /** * Deactivates every particle in this emitter immediately. * * This particles are killed but do not emit an event or callback. */ killAll(): this; /** * Calls a function for each active particle in this emitter. The function is * sent two parameters: a reference to the Particle instance and to this Emitter. * @param callback The function. * @param context The functions calling context. */ forEachAlive(callback: Phaser.Types.GameObjects.Particles.ParticleEmitterCallback, context: any): this; /** * Calls a function for each inactive particle in this emitter. * @param callback The function. * @param context The functions calling context. */ forEachDead(callback: Phaser.Types.GameObjects.Particles.ParticleEmitterCallback, context: any): this; /** * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#on} the emitter and resets the flow counter. * * If this emitter is in flow mode (frequency >= 0; the default), the particle flow will start (or restart). * * If this emitter is in explode mode (frequency = -1), nothing will happen. * Use {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} or {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} instead. * * Calling this method will emit the `START` event. * @param advance Advance this number of ms in time through the emitter. Default 0. * @param duration Limit this emitter to only emit particles for the given number of ms. Setting this parameter will override any duration already set in the Emitter configuration object. Default 0. */ start(advance?: number, duration?: number): this; /** * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#emitting off} the emitter and * stops it from emitting further particles. Currently alive particles will remain * active until they naturally expire unless you set the `kill` parameter to `true`. * * Calling this method will emit the `STOP` event. When the final particle has * expired the `COMPLETE` event will be emitted. * @param kill Kill all particles immediately (true), or leave them to die after their lifespan expires? (false, the default) Default false. */ stop(kill?: boolean): this; /** * {@link Phaser.GameObjects.Particles.ParticleEmitter#active Deactivates} the emitter. */ pause(): this; /** * {@link Phaser.GameObjects.Particles.ParticleEmitter#active Activates} the emitter. */ resume(): this; /** * Set the property by which active particles are sorted prior to be rendered. * * It allows you to control the rendering order of the particles. * * This can be any valid property of the `Particle` class, such as `y`, `alpha` * or `lifeT`. * * The 'alive' particles array is sorted in place each game frame. Setting a * sort property will override the `particleBringToTop` setting. * * If you wish to use your own sorting function, see `setSortCallback` instead. * @param property The property on the `Particle` class to sort by. * @param ascending Should the particles be sorted in ascending or descending order? Default true. */ setSortProperty(property?: string, ascending?: boolean): this; /** * Sets a callback to be used to sort the particles before rendering each frame. * * This allows you to define your own logic and behavior in the callback. * * The callback will be sent two parameters: the two Particles being compared, * and must adhere to the criteria of the `compareFn` in `Array.sort`: * * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#descripti on * * Call this method with no parameters to reset the sort callback. * * Setting your own callback will override both the `particleBringToTop` and * `sortProperty` settings of this Emitter. * @param callback The callback to invoke when the particles are sorted. Leave undefined to reset to the default. */ setSortCallback(callback?: Phaser.Types.GameObjects.Particles.ParticleSortCallback): this; /** * Sorts active particles with {@link Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback}. */ depthSort(): this; /** * Calculates the difference of two particles, for sorting them by depth. * @param a The first particle. * @param b The second particle. */ depthSortCallback(a: object, b: object): number; /** * Puts the emitter in flow mode (frequency >= 0) and starts (or restarts) a particle flow. * * To resume a flow at the current frequency and quantity, use {@link Phaser.GameObjects.Particles.ParticleEmitter#start} instead. * @param frequency The time interval (>= 0) of each flow cycle, in ms. * @param count The number of particles to emit at each flow cycle. Default 1. * @param stopAfter Stop this emitter from firing any more particles once this value is reached. Set to zero for unlimited. Setting this parameter will override any `stopAfter` value already set in the Emitter configuration object. */ flow(frequency: number, count?: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType, stopAfter?: number): this; /** * Puts the emitter in explode mode (frequency = -1), stopping any current particle flow, and emits several particles all at once. * @param count The number of Particles to emit. Default this.quantity. * @param x The x coordinate to emit the Particles from. Default this.x. * @param y The y coordinate to emit the Particles from. Default this.x. */ explode(count?: number, x?: number, y?: number): Phaser.GameObjects.Particles.Particle; /** * Emits particles at the given position. If no position is given, it will * emit from this Emitters current location. * @param x The x coordinate to emit the Particles from. Default this.x. * @param y The y coordinate to emit the Particles from. Default this.x. * @param count The number of Particles to emit. Default this.quantity. */ emitParticleAt(x?: number, y?: number, count?: number): Phaser.GameObjects.Particles.Particle; /** * Emits particles at a given position (or the emitters current position). * @param count The number of Particles to emit. Default this.quantity. * @param x The x coordinate to emit the Particles from. Default this.x. * @param y The y coordinate to emit the Particles from. Default this.x. */ emitParticle(count?: number, x?: number, y?: number): Phaser.GameObjects.Particles.Particle; /** * Fast forwards this Particle Emitter and all of its particles. * * Works by running the Emitter `preUpdate` handler in a loop until the `time` * has been reached at `delta` steps per loop. * * All callbacks and emitter related events that would normally be fired * will still be invoked. * * You can make an emitter 'fast forward' via the emitter config using the * `advance` property. Set this value to the number of ms you wish the * emitter to be fast-forwarded by. Or, call this method post-creation. * @param time The number of ms to advance the Particle Emitter by. * @param delta The amount of delta to use for each step. Defaults to 1000 / 60. */ fastForward(time: number, delta?: number): this; /** * Updates this emitter and its particles. * @param time The current timestamp as generated by the Request Animation Frame or SetTimeout. * @param delta The delta time, in ms, elapsed since the last frame. */ preUpdate(time: number, delta: number): void; /** * Takes either a Rectangle Geometry object or an Arcade Physics Body and tests * to see if it intersects with any currently alive Particle in this Emitter. * * Overlapping particles are returned in an array, where you can perform further * processing on them. If nothing overlaps then the array will be empty. * @param target A Rectangle or Arcade Physics Body to check for intersection against all alive particles. */ overlap(target: Phaser.Geom.Rectangle | Phaser.Physics.Arcade.Body): Phaser.GameObjects.Particles.Particle[]; /** * Returns a bounds Rectangle calculated from the bounds of all currently * _active_ Particles in this Emitter. If this Emitter has only just been * created and not yet rendered, then calling this method will return a Rectangle * with a max safe integer for dimensions. Use the `advance` parameter to * avoid this. * * Typically it takes a few seconds for a flow Emitter to 'warm up'. You can * use the `advance` and `delta` parameters to force the Emitter to * 'fast forward' in time to try and allow the bounds to be more accurate, * as it will calculate the bounds based on the particle bounds across all * timesteps, giving a better result. * * You can also use the `padding` parameter to increase the size of the * bounds. Emitters with a lot of randomness in terms of direction or lifespan * can often return a bounds smaller than their possible maximum. By using * the `padding` (and `advance` if needed) you can help limit this. * @param padding The amount of padding, in pixels, to add to the bounds Rectangle. * @param advance The number of ms to advance the Particle Emitter by. Defaults to 0, i.e. not used. * @param delta The amount of delta to use for each step. Defaults to 1000 / 60. * @param output The Rectangle to store the results in. If not given a new one will be created. */ getBounds(padding?: number, advance?: number, delta?: number, output?: Phaser.Geom.Rectangle): Phaser.Geom.Rectangle; /** * Prints a warning to the console if you mistakenly call this function * thinking it works the same way as Phaser v3.55. */ createEmitter(): void; /**