IParticleSystem

Interface representing a particle system in Babylon.js. This groups the common functionalities that needs to be implemented in order to create a particle system. A particle system represents a way to manage particles from their emission to their animation and rendering.

Hierarchy

  • IParticleSystem

Implemented by

Index

Properties

animations

animations: Animation[]

List of animations used by the particle system.

billboardMode

billboardMode: number

Gets or sets the billboard mode to use when isBillboardBased = true. Only BABYLON.AbstractMesh.BILLBOARDMODE_ALL and AbstractMesh.BILLBOARDMODE_Y are supported so far

blendMode

blendMode: number

Blend mode use to render the particle, it can be either ParticleSystem.BLENDMODE_ONEONE, ParticleSystem.BLENDMODE_STANDARD or ParticleSystem.BLENDMODE_ADD.

color1

color1: Color4

Random color of each particle after it has been emitted, between color1 and color2 vectors.

color2

color2: Color4

Random color of each particle after it has been emitted, between color1 and color2 vectors.

colorDead

colorDead: Color4

Color the particle will have at the end of its lifetime.

emitRate

emitRate: number

The maximum number of particles to emit per frame until we reach the activeParticleCount value

emitter

The emitter represents the Mesh or position we are attaching the particle system to.

endSpriteCellID

endSpriteCellID: number

If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display

gravity

gravity: Vector3

You can use gravity if you want to give an orientation to your particles.

id

id: string

The id of the Particle system.

isBillboardBased

isBillboardBased: boolean

Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction

layerMask

layerMask: number

The layer mask we are rendering the particles through.

limitVelocityDamping

limitVelocityDamping: number

Gets or sets a value indicating the damping to apply if the limit velocity factor is reached

maxAngularSpeed

maxAngularSpeed: number

Maximum angular speed of emitting particles (Z-axis rotation for each particle).

maxEmitPower

maxEmitPower: number

Maximum power of emitting particles.

maxInitialRotation

maxInitialRotation: number

Gets or sets the maximal initial rotation in radians.

maxLifeTime

maxLifeTime: number

Maximum life time of emitting particles.

maxScaleX

maxScaleX: number

Maximum scale of emitting particles on X axis.

maxScaleY

maxScaleY: number

Maximum scale of emitting particles on Y axis.

maxSize

maxSize: number

Maximum Size of emitting particles.

minAngularSpeed

minAngularSpeed: number

Minimum angular speed of emitting particles (Z-axis rotation for each particle).

minEmitPower

minEmitPower: number

Minimum power of emitting particles.

minInitialRotation

minInitialRotation: number

Gets or sets the minimal initial rotation in radians.

minLifeTime

minLifeTime: number

Minimum life time of emitting particles.

minScaleX

minScaleX: number

Minimum scale of emitting particles on X axis.

minScaleY

minScaleY: number

Minimum scale of emitting particles on Y axis.

minSize

minSize: number

Minimum Size of emitting particles.

name

name: string

The name of the Particle system.

noiseStrength

noiseStrength: Vector3

Gets or sets the strength to apply to the noise value (default is (10, 10, 10))

noiseTexture

noiseTexture: Nullable<BaseTexture>

Gets or sets a texture used to add random noise to particle positions

particleEmitterType

particleEmitterType: Nullable<IParticleEmitterType>

The particle emitter type defines the emitter used by the particle system. It can be for example box, sphere, or cone...

particleTexture

particleTexture: Nullable<Texture>

The texture used to render each particle. (this can be a spritesheet)

preWarmCycles

preWarmCycles: number

Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0

preWarmStepOffset

preWarmStepOffset: number

Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)

renderingGroupId

renderingGroupId: number

The rendering group used by the Particle system to chose when to render.

spriteCellChangeSpeed

spriteCellChangeSpeed: number

If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)

spriteCellHeight

spriteCellHeight: number

If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use

spriteCellWidth

spriteCellWidth: number

If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use

startSpriteCellID

startSpriteCellID: number

If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display

targetStopDuration

targetStopDuration: number

The amount of time the particle system is running (depends of the overall update speed).

translationPivot

translationPivot: Vector2

Gets or sets a Vector2 used to move the pivot (by default (0,0))

updateSpeed

updateSpeed: number

The overall motion speed (0.01 is default update speed, faster updates = faster animation)

Methods

addAngularSpeedGradient

  • addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem
  • Adds a new angular speed gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • factor: number

      defines the angular speed to affect to the specified gradient

    • Optional factor2: number

      defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from

    Returns IParticleSystem

    the current particle system

addColorGradient

  • Adds a new color gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • color1: Color4
    • Optional color2: Color4

      defines an additional color used to define a range ([color, color2]) with main color to pick the final color from

    Returns IParticleSystem

    the current particle system

addLimitVelocityGradient

  • addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem
  • Adds a new limit velocity gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • factor: number

      defines the limit velocity to affect to the specified gradient

    • Optional factor2: number

      defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from

    Returns IParticleSystem

    the current particle system

addSizeGradient

  • addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem
  • Adds a new size gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • factor: number

      defines the size factor to affect to the specified gradient

    • Optional factor2: number

      defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from

    Returns IParticleSystem

    the current particle system

addVelocityGradient

  • addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem
  • Adds a new velocity gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • factor: number

      defines the velocity to affect to the specified gradient

    • Optional factor2: number

      defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from

    Returns IParticleSystem

    the current particle system

animate

  • animate(): void
  • Animates the particle system for this frame.

    Returns void

clone

  • Clones the particle system.

    Parameters

    • name: string

      The name of the cloned object

    • newEmitter: any

      The new emitter to use

    Returns Nullable<IParticleSystem>

    the cloned particle system

dispose

  • dispose(disposeTexture?: boolean): void
  • Dispose the particle system and frees its associated resources.

    Parameters

    • Optional disposeTexture: boolean

      defines if the particule texture must be disposed as well (true by default)

    Returns void

getAngularSpeedGradients

  • Gets the current list of angular speed gradients. You must use addAngularSpeedGradient and removeAngularSpeedGradient to udpate this list

    Returns Nullable<Array<FactorGradient>>

    the list of angular speed gradients

getCapacity

  • getCapacity(): number
  • Gets the maximum number of particles active at the same time.

    Returns number

    The max number of active particles.

getColorGradients

  • Gets the current list of color gradients. You must use addColorGradient and removeColorGradient to udpate this list

    Returns Nullable<Array<ColorGradient>>

    the list of color gradients

getLimitVelocityGradients

  • Gets the current list of limit velocity gradients. You must use addLimitVelocityGradient and removeLimitVelocityGradient to udpate this list

    Returns Nullable<Array<FactorGradient>>

    the list of limit velocity gradients

getSizeGradients

  • Gets the current list of size gradients. You must use addSizeGradient and removeSizeGradient to udpate this list

    Returns Nullable<Array<FactorGradient>>

    the list of size gradients

getVelocityGradients

  • Gets the current list of velocity gradients. You must use addVelocityGradient and removeVelocityGradient to udpate this list

    Returns Nullable<Array<FactorGradient>>

    the list of velocity gradients

isReady

  • isReady(): boolean
  • Is this system ready to be used/rendered

    Returns boolean

    true if the system is ready

isStarted

  • isStarted(): boolean
  • isStarted(): boolean
  • Gets Wether the system has been started.

    Returns boolean

    True if it has been started, otherwise false.

  • Gets if the particle system has been started.

    Returns boolean

    true if the system has been started, otherwise false.

rebuild

  • rebuild(): void
  • Rebuild the particle system

    Returns void

removeAngularSpeedGradient

  • Remove a specific angular speed gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns IParticleSystem

    the current particle system

removeColorGradient

  • Remove a specific color gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns IParticleSystem

    the current particle system

removeLimitVelocityGradient

  • Remove a specific limit velocity gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns IParticleSystem

    the current particle system

removeSizeGradient

  • Remove a specific size gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns IParticleSystem

    the current particle system

removeVelocityGradient

  • Remove a specific velocity gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns IParticleSystem

    the current particle system

render

  • render(): number
  • Renders the particle system in its current state.

    Returns number

    the current number of particles

reset

  • reset(): void
  • Remove all active particles

    Returns void

serialize

  • serialize(): any
  • Serializes the particle system to a JSON object.

    Returns any

    the JSON object

start

  • start(delay?: number): void
  • Starts the particle system and begins to emit

    Parameters

    • Optional delay: number

      defines the delay in milliseconds before starting the system (0 by default)

    Returns void

stop

  • stop(): void
  • Stops the particle system.

    Returns void

Generated using TypeDoc