Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ParticleSystem

This represents a particle system in Babylon. Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust. Particles can take different shapes while emitted like box, sphere, cone or you can write your custom function.

example

https://doc.babylonjs.com/babylon101/particles

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • Instantiates a particle system. Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.

    Parameters

    • name: string

      The name of the particle system

    • capacity: number

      The max number of particles alive at the same time

    • sceneOrEngine: Scene | ThinEngine

      The scene the particle system belongs to or the engine to use if no scene

    • Optional customEffect: Nullable<Effect>

      a custom effect used to change the way particles are rendered by default

    • Optional isAnimationSheetEnabled: boolean

      Must be true if using a spritesheet to animate the particles texture

    • Optional epsilon: number

      Offset used to render the particles

    Returns ParticleSystem

Properties

activeSubSystemsSearch playground for activeSubSystems

activeSubSystems: Array<ParticleSystem>

The current active Sub-systems, this property is used by the root particle system only.

animationsSearch playground for animations

animations: Animation[]

List of animations used by the particle system.

beginAnimationFromSearch playground for beginAnimationFrom

beginAnimationFrom: number

Gets or sets the frame to start the animation from when beginAnimationOnStart is true

beginAnimationLoopSearch playground for beginAnimationLoop

beginAnimationLoop: boolean

Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true

beginAnimationOnStartSearch playground for beginAnimationOnStart

beginAnimationOnStart: boolean

Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called

beginAnimationToSearch playground for beginAnimationTo

beginAnimationTo: number

Gets or sets the frame to end the animation on when beginAnimationOnStart is true

blendModeSearch playground for blendMode

blendMode: number

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

color1Search playground for color1

color1: Color4

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

color2Search playground for color2

color2: Color4

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

colorDeadSearch playground for colorDead

colorDead: Color4

Color the particle will have at the end of its lifetime

customShaderSearch playground for customShader

customShader: any

This can help using your own shader to render the particle system. The according effect will be created

defaultProjectionMatrixSearch playground for defaultProjectionMatrix

defaultProjectionMatrix: Matrix

Gets or sets a matrix to use to compute projection

defaultViewMatrixSearch playground for defaultViewMatrix

defaultViewMatrix: Matrix

Gets or sets a matrix to use to compute view

disposeOnStopSearch playground for disposeOnStop

disposeOnStop: boolean

Specifies whether the particle system will be disposed once it reaches the end of the animation.

emitRateSearch playground for emitRate

emitRate: number

The maximum number of particles to emit per frame

emitterSearch playground for emitter

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

endSpriteCellIDSearch playground for endSpriteCellID

endSpriteCellID: number

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

forceDepthWriteSearch playground for forceDepthWrite

forceDepthWrite: boolean

Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls to override the particles.

gravitySearch playground for gravity

gravity: Vector3

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

idSearch playground for id

id: string

The id of the Particle system.

isLocalSearch playground for isLocal

isLocal: boolean

Specifies if the particles are updated in emitter local space or world space

layerMaskSearch playground for layerMask

layerMask: number

The layer mask we are rendering the particles through.

limitVelocityDampingSearch playground for limitVelocityDamping

limitVelocityDamping: number

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

manualEmitCountSearch playground for manualEmitCount

manualEmitCount: number

If you want to launch only a few particles at once, that can be done, as well.

maxAngularSpeedSearch playground for maxAngularSpeed

maxAngularSpeed: number

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

maxEmitPowerSearch playground for maxEmitPower

maxEmitPower: number

Maximum power of emitting particles.

maxInitialRotationSearch playground for maxInitialRotation

maxInitialRotation: number

Gets or sets the maximal initial rotation in radians.

maxLifeTimeSearch playground for maxLifeTime

maxLifeTime: number

Maximum life time of emitting particles.

maxScaleXSearch playground for maxScaleX

maxScaleX: number

Maximum scale of emitting particles on X axis.

maxScaleYSearch playground for maxScaleY

maxScaleY: number

Maximum scale of emitting particles on Y axis.

maxSizeSearch playground for maxSize

maxSize: number

Maximum Size of emitting particles.

minAngularSpeedSearch playground for minAngularSpeed

minAngularSpeed: number

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

minEmitPowerSearch playground for minEmitPower

minEmitPower: number

Minimum power of emitting particles.

minInitialRotationSearch playground for minInitialRotation

minInitialRotation: number

Gets or sets the minimal initial rotation in radians.

minLifeTimeSearch playground for minLifeTime

minLifeTime: number

Minimum life time of emitting particles.

minScaleXSearch playground for minScaleX

minScaleX: number

Minimum scale of emitting particles on X axis.

minScaleYSearch playground for minScaleY

minScaleY: number

Minimum scale of emitting particles on Y axis.

minSizeSearch playground for minSize

minSize: number

Minimum Size of emitting particles.

nameSearch playground for name

name: string

The friendly name of the Particle system.

noiseStrengthSearch playground for noiseStrength

noiseStrength: Vector3

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

onAnimationEndSearch playground for onAnimationEnd

onAnimationEnd: Nullable<() => void>

Callback triggered when the particle animation is ending.

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<IParticleSystem>

An event triggered when the system is disposed

onStoppedObservableSearch playground for onStoppedObservable

onStoppedObservable: Observable<IParticleSystem>

An event triggered when the system is stopped

particleEmitterTypeSearch playground for particleEmitterType

particleEmitterType: IParticleEmitterType

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

particleTextureSearch playground for particleTexture

particleTexture: Nullable<BaseTexture>

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

preWarmCyclesSearch playground for 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

preWarmStepOffsetSearch playground for preWarmStepOffset

preWarmStepOffset: number

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

preventAutoStartSearch playground for preventAutoStart

preventAutoStart: boolean

By default particle system starts as soon as they are created. This prevents the automatic start to happen and let you decide when to start emitting particles.

recycleParticleSearch playground for recycleParticle

recycleParticle: (particle: Particle) => void

"Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list. Its lifetime will start back at 0.

param

Type declaration

renderingGroupIdSearch playground for renderingGroupId

renderingGroupId: number

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

snippetIdSearch playground for snippetId

snippetId: string

Snippet ID if the particle system was created from the snippet server

spriteCellChangeSpeedSearch playground for 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)

spriteCellHeightSearch playground for spriteCellHeight

spriteCellHeight: number

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

spriteCellLoopSearch playground for spriteCellLoop

spriteCellLoop: boolean

If using a spritesheet (isAnimationSheetEnabled), defines wether the sprite animation is looping

spriteCellWidthSearch playground for spriteCellWidth

spriteCellWidth: number

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

spriteRandomStartCellSearch playground for spriteRandomStartCell

spriteRandomStartCell: boolean

This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID

startDelaySearch playground for startDelay

startDelay: number

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

startDirectionFunctionSearch playground for startDirectionFunction

startDirectionFunction: (worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean) => void

This function can be defined to specify initial direction for every new particle. It by default use the emitterType defined function

Type declaration

startPositionFunctionSearch playground for startPositionFunction

startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean) => void

This function can be defined to specify initial position for every new particle. It by default use the emitterType defined function

Type declaration

startSpriteCellIDSearch playground for startSpriteCellID

startSpriteCellID: number

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

subEmittersSearch playground for subEmitters

subEmitters: Array<ParticleSystem | SubEmitter | Array<SubEmitter>>

The Sub-emitters templates that will be used to generate the sub particle system to be associated with the system, this property is used by the root particle system only. When a particle is spawned, an array will be chosen at random and all the emitters in that array will be attached to the particle. (Default: [])

targetStopDurationSearch playground for targetStopDuration

targetStopDuration: number

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

textureMaskSearch playground for textureMask

textureMask: Color4

An optional mask to filter some colors out of the texture, or filter a part of the alpha channel

translationPivotSearch playground for translationPivot

translationPivot: Vector2

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

uniqueIdSearch playground for uniqueId

uniqueId: number

Gets or sets the unique id of the particle system

updateFunctionSearch playground for updateFunction

updateFunction: (particles: Particle[]) => void

This function can be defined to provide custom update for active particles. This function will be called instead of regular update (age, position, color, etc.). Do not forget that this function will be called on every frame so try to keep it simple and fast :)

Type declaration

updateSpeedSearch playground for updateSpeed

updateSpeed: number

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

worldOffsetSearch playground for worldOffset

worldOffset: Vector3

Gets or sets a world offset applied to all particles

Static Readonly BILLBOARDMODE_ALLSearch playground for BILLBOARDMODE_ALL

BILLBOARDMODE_ALL: 7 = 7

Billboard mode will apply to all axes

Static Readonly BILLBOARDMODE_STRETCHEDSearch playground for BILLBOARDMODE_STRETCHED

BILLBOARDMODE_STRETCHED: 8 = 8

Special billboard mode where the particle will be biilboard to the camera but rotated to align with direction

Static Readonly BILLBOARDMODE_YSearch playground for BILLBOARDMODE_Y

BILLBOARDMODE_Y: 2 = 2

Billboard mode will only apply to Y axis

Static BLENDMODE_ADDSearch playground for BLENDMODE_ADD

BLENDMODE_ADD: number

Add current color and particle color multiplied by particle’s alpha

Static BLENDMODE_MULTIPLYSearch playground for BLENDMODE_MULTIPLY

BLENDMODE_MULTIPLY: number

Multiply current color with particle color

Static BLENDMODE_MULTIPLYADDSearch playground for BLENDMODE_MULTIPLYADD

BLENDMODE_MULTIPLYADD: number

Multiply current color with particle color then add current color and particle color multiplied by particle’s alpha

Static BLENDMODE_ONEONESearch playground for BLENDMODE_ONEONE

BLENDMODE_ONEONE: number

Source color is added to the destination color without alpha affecting the result

Static BLENDMODE_STANDARDSearch playground for BLENDMODE_STANDARD

BLENDMODE_STANDARD: number

Blend current color and particle color using particle’s alpha

Accessors

billboardMode

  • get billboardMode(): number
  • set billboardMode(value: number): any
  • Gets or sets the billboard mode to use when isBillboardBased = true. Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED

    Returns number

  • Gets or sets the billboard mode to use when isBillboardBased = true. Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED

    Parameters

    • value: number

    Returns any

direction1

  • Random direction of each particle after it has been emitted, between direction1 and direction2 vectors. This only works when particleEmitterTyps is a BoxParticleEmitter

    Returns Vector3

  • Random direction of each particle after it has been emitted, between direction1 and direction2 vectors. This only works when particleEmitterTyps is a BoxParticleEmitter

    Parameters

    Returns any

direction2

  • Random direction of each particle after it has been emitted, between direction1 and direction2 vectors. This only works when particleEmitterTyps is a BoxParticleEmitter

    Returns Vector3

  • Random direction of each particle after it has been emitted, between direction1 and direction2 vectors. This only works when particleEmitterTyps is a BoxParticleEmitter

    Parameters

    Returns any

imageProcessingConfiguration

indexBuffer

  • Gets the index buffer used by the particle system (or null if no index buffer is used (if _useInstancing=true))

    Returns Nullable<DataBuffer>

isAnimationSheetEnabled

  • get isAnimationSheetEnabled(): boolean
  • set isAnimationSheetEnabled(value: boolean): any
  • Gets or sets whether an animation sprite sheet is enabled or not on the particle system

    Returns boolean

  • Gets or sets whether an animation sprite sheet is enabled or not on the particle system

    Parameters

    • value: boolean

    Returns any

isBillboardBased

  • get isBillboardBased(): boolean
  • set isBillboardBased(value: boolean): any
  • Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction

    Returns boolean

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

    Parameters

    • value: boolean

    Returns any

maxEmitBox

  • Maximum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so. This only works when particleEmitterTyps is a BoxParticleEmitter

    Returns Vector3

  • Maximum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so. This only works when particleEmitterTyps is a BoxParticleEmitter

    Parameters

    Returns any

minEmitBox

  • Minimum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so. This only works when particleEmitterTyps is a BoxParticleEmitter

    Returns Vector3

  • Minimum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so. This only works when particleEmitterTyps is a BoxParticleEmitter

    Parameters

    Returns any

noiseTexture

onBeforeDrawParticlesObservable

  • Observable that will be called just before the particles are drawn

    Returns Observable<Nullable<Effect>>

onDispose

  • set onDispose(callback: () => void): any
  • Sets a callback that will be triggered when the system is disposed

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns any

particles

  • Gets the current list of active particles

    Returns Particle[]

useRampGradients

  • get useRampGradients(): boolean
  • set useRampGradients(value: boolean): any

vertexBuffers

  • Gets the vertex buffers used by the particle system

    Returns Immutable<{}>

vertexShaderName

  • get vertexShaderName(): string
  • Gets the name of the particle vertex shader

    Returns string

Methods

addAlphaRemapGradientSearch playground for addAlphaRemapGradient

  • addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem
  • Adds a new alpha remap gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • min: number

      defines the alpha remap minimal range

    • max: number

      defines the alpha remap maximal range

    Returns IParticleSystem

    the current particle system

addAngularSpeedGradientSearch playground for 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

addColorGradientSearch playground for addColorGradient

  • Adds a new color gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • color1: Color4

      defines the color to affect to the specified gradient

    • 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

    this particle system

addColorRemapGradientSearch playground for addColorRemapGradient

  • addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem
  • Adds a new color remap gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • min: number

      defines the color remap minimal range

    • max: number

      defines the color remap maximal range

    Returns IParticleSystem

    the current particle system

addDragGradientSearch playground for addDragGradient

  • addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem
  • Adds a new drag gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • factor: number

      defines the drag value 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

addEmitRateGradientSearch playground for addEmitRateGradient

  • addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem
  • Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • factor: number

      defines the emit rate value 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

addLifeTimeGradientSearch playground for addLifeTimeGradient

  • addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem
  • Adds a new life time gradient

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • factor: number

      defines the life time 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

addLimitVelocityGradientSearch playground for 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 value 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

addRampGradientSearch playground for addRampGradient

  • Adds a new ramp gradient used to remap particle colors

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • color: Color3

      defines the color to affect to the specified gradient

    Returns ParticleSystem

    the current particle system

addSizeGradientSearch playground for 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

addStartSizeGradientSearch playground for addStartSizeGradient

  • addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem
  • Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)

    Parameters

    • gradient: number

      defines the gradient to use (between 0 and 1)

    • factor: number

      defines the start size value 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

addVelocityGradientSearch playground for 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

animateSearch playground for animate

  • animate(preWarmOnly?: boolean): void
  • Animates the particle system for the current frame by emitting new particles and or animating the living ones.

    Parameters

    • Optional preWarmOnly: boolean

      will prevent the system from updating the vertex buffer (default is false)

    Returns void

cloneSearch playground for clone

  • Clones the particle system.

    Parameters

    • name: string

      The name of the cloned object

    • newEmitter: any

      The new emitter to use

    Returns ParticleSystem

    the cloned particle system

createBoxEmitterSearch playground for createBoxEmitter

  • Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)

    Parameters

    • direction1: Vector3

      Particles are emitted between the direction1 and direction2 from within the box

    • direction2: Vector3

      Particles are emitted between the direction1 and direction2 from within the box

    • minEmitBox: Vector3

      Particles are emitted from the box between minEmitBox and maxEmitBox

    • maxEmitBox: Vector3

      Particles are emitted from the box between minEmitBox and maxEmitBox

    Returns BoxParticleEmitter

    the emitter

createConeEmitterSearch playground for createConeEmitter

createCylinderEmitterSearch playground for createCylinderEmitter

  • createCylinderEmitter(radius?: number, height?: number, radiusRange?: number, directionRandomizer?: number): CylinderParticleEmitter
  • Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)

    Parameters

    • Optional radius: number

      The radius of the emission cylinder

    • Optional height: number

      The height of the emission cylinder

    • Optional radiusRange: number

      The range of emission [0-1] 0 Surface only, 1 Entire Radius

    • Optional directionRandomizer: number

      How much to randomize the particle direction [0-1]

    Returns CylinderParticleEmitter

    the emitter

createDirectedCylinderEmitterSearch playground for createDirectedCylinderEmitter

  • Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)

    Parameters

    • Optional radius: number

      The radius of the cylinder to emit from

    • Optional height: number

      The height of the emission cylinder

    • Optional radiusRange: number

      the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)

    • Optional direction1: Vector3

      Particles are emitted between the direction1 and direction2 from within the cylinder

    • Optional direction2: Vector3

      Particles are emitted between the direction1 and direction2 from within the cylinder

    Returns CylinderDirectedParticleEmitter

    the emitter

createDirectedSphereEmitterSearch playground for createDirectedSphereEmitter

createHemisphericEmitterSearch playground for createHemisphericEmitter

createPointEmitterSearch playground for createPointEmitter

createSphereEmitterSearch playground for createSphereEmitter

disposeSearch playground for dispose

  • dispose(disposeTexture?: boolean): void
  • Disposes the particle system and free the associated resources

    Parameters

    • Optional disposeTexture: boolean

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

    Returns void

fillDefinesSearch playground for fillDefines

  • fillDefines(defines: Array<string>, blendMode: number): void
  • Fill the defines array according to the current settings of the particle system

    Parameters

    • defines: Array<string>

      Array to be updated

    • blendMode: number

      blend mode to take into account when updating the array

    Returns void

fillUniformsAttributesAndSamplerNamesSearch playground for fillUniformsAttributesAndSamplerNames

  • fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void
  • Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system

    Parameters

    • uniforms: Array<string>

      Uniforms array to fill

    • attributes: Array<string>

      Attributes array to fill

    • samplers: Array<string>

      Samplers array to fill

    Returns void

forceRefreshGradientsSearch playground for forceRefreshGradients

  • forceRefreshGradients(): void
  • Force the system to rebuild all gradients that need to be resync

    Returns void

getActiveCountSearch playground for getActiveCount

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

    Returns number

    The number of active particles.

getAlphaRemapGradientsSearch playground for getAlphaRemapGradients

getAngularSpeedGradientsSearch playground for getAngularSpeedGradients

getCapacitySearch playground for getCapacity

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

    Returns number

    The max number of active particles.

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Returns the string "ParticleSystem"

    Returns string

    a string containing the class name

getColorGradientsSearch playground for getColorGradients

getColorRemapGradientsSearch playground for getColorRemapGradients

getCustomEffectSearch playground for getCustomEffect

  • Gets the custom effect used to render the particles

    Parameters

    • Optional blendMode: number

      Blend mode for which the effect should be retrieved

    Returns Nullable<Effect>

    The effect

getDragGradientsSearch playground for getDragGradients

getEmitRateGradientsSearch playground for getEmitRateGradients

getLifeTimeGradientsSearch playground for getLifeTimeGradients

getLimitVelocityGradientsSearch playground for getLimitVelocityGradients

getRampGradientsSearch playground for getRampGradients

  • Gets the current list of ramp gradients. You must use addRampGradient and removeRampGradient to update this list

    Returns Nullable<Array<Color3Gradient>>

    the list of ramp gradients

getSceneSearch playground for getScene

getSizeGradientsSearch playground for getSizeGradients

getStartSizeGradientsSearch playground for getStartSizeGradients

getVelocityGradientsSearch playground for getVelocityGradients

isAliveSearch playground for isAlive

  • isAlive(): boolean
  • Gets whether there are still active particles in the system.

    Returns boolean

    True if it is alive, otherwise false.

isReadySearch playground for isReady

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

    Returns boolean

    true if the system is ready

isStartedSearch playground for isStarted

  • isStarted(): boolean
  • Gets if the system has been started. (Note: this will still be true after stop is called)

    Returns boolean

    True if it has been started, otherwise false.

isStoppingSearch playground for isStopping

  • isStopping(): boolean
  • Gets a boolean indicating that the system is stopping

    Returns boolean

    true if the system is currently stopping

rebuildSearch playground for rebuild

  • rebuild(): void
  • Rebuilds the particle system.

    Returns void

removeAlphaRemapGradientSearch playground for removeAlphaRemapGradient

  • Remove a specific alpha remap gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns IParticleSystem

    the current particle system

removeAngularSpeedGradientSearch playground for removeAngularSpeedGradient

removeColorGradientSearch playground for removeColorGradient

removeColorRemapGradientSearch playground for removeColorRemapGradient

  • Remove a specific color remap gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns IParticleSystem

    the current particle system

removeDragGradientSearch playground for removeDragGradient

  • Remove a specific drag gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns IParticleSystem

    the current particle system

removeEmitRateGradientSearch playground for removeEmitRateGradient

removeLifeTimeGradientSearch playground for removeLifeTimeGradient

removeLimitVelocityGradientSearch playground for removeLimitVelocityGradient

removeRampGradientSearch playground for removeRampGradient

  • Remove a specific ramp gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns ParticleSystem

    the current particle system

removeSizeGradientSearch playground for removeSizeGradient

  • Remove a specific size gradient

    Parameters

    • gradient: number

      defines the gradient to remove

    Returns IParticleSystem

    the current particle system

removeStartSizeGradientSearch playground for removeStartSizeGradient

removeVelocityGradientSearch playground for removeVelocityGradient

renderSearch playground for render

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

    Returns number

    the current number of particles

resetSearch playground for reset

  • reset(): void
  • Remove all active particles

    Returns void

resetDrawCacheSearch playground for resetDrawCache

  • resetDrawCache(): void
  • Resets the draw wrappers cache

    Returns void

serializeSearch playground for serialize

  • serialize(serializeTexture?: boolean): any
  • Serializes the particle system to a JSON object

    Parameters

    • Optional serializeTexture: boolean

      defines if the texture must be serialized as well

    Returns any

    the JSON object

setCustomEffectSearch playground for setCustomEffect

  • Sets the custom effect used to render the particles

    Parameters

    • effect: Nullable<Effect>

      The effect to set

    • Optional blendMode: number

      Blend mode for which the effect should be set

    Returns void

startSearch playground for 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 (this.startDelay by default)

    Returns void

stopSearch playground for stop

  • stop(stopSubEmitters?: boolean): void
  • Stops the particle system.

    Parameters

    • Optional stopSubEmitters: boolean

      if true it will stop the current system and all created sub-Systems if false it will stop the current root system only, this param is used by the root particle system only. the default value is true.

    Returns void

Static ParseSearch playground for Parse

  • Parses a JSON object to create a particle system.

    Parameters

    • parsedParticleSystem: any

      The JSON object to parse

    • sceneOrEngine: Scene | ThinEngine

      The scene or the engine to create the particle system in

    • rootUrl: string

      The root url to use to load external dependencies like texture

    • Optional doNotStart: boolean

      Ignore the preventAutoStart attribute and does not start

    • Optional capacity: number

      defines the system capacity (if null or undefined the sotred capacity will be used)

    Returns ParticleSystem

    the Parsed particle system

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static property
  • Static method