@emile/engine / rendering/particles/emitter / ParticleEmitter
Class: ParticleEmitter
Defined in: src/rendering/particles/emitter.ts:51
A component that represents a particle emitter.
This component is used to emit particles from an entity, using the particle system.
Extends
Constructors
new ParticleEmitter()
new ParticleEmitter():
ParticleEmitter
Defined in: src/rendering/particles/emitter.ts:376
Returns
ParticleEmitter
Overrides
Properties
$callbacks
protected$callbacks:object
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:35
Index Signature
[op: number]: Function[]
Inherited from
$changes
protected$changes:ChangeTree
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:34
Inherited from
componentId
readonlycomponentId:number
Defined in: src/ecs/component.ts:26
Inherited from
enabled
enabled:
boolean=true
Defined in: src/rendering/particles/emitter.ts:63
Whether the particle emitter is enabled.
When disabled, the particle emitter will not emit any particles.
When enabled, the particle emitter will emit particles based on the settings.
Default
truegravityScale
gravityScale:
number=0
Defined in: src/rendering/particles/emitter.ts:72
The scale factor of the gravity applied to the particles.
Set to 0 to disable gravity.
Default
0maxParticles
maxParticles:
number=1000
Defined in: src/rendering/particles/emitter.ts:79
The maximum number of particles that can be alive at once. After this is reached no more particles will be emitted until some die.
Default
1000particleAcceleration
particleAcceleration:
number=0
Defined in: src/rendering/particles/emitter.ts:272
This is the rate at which the particle will accelerate in meters per second squared.
Default
0particleAccelerationVariance
particleAccelerationVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:281
The variance in the acceleration rate of an emitted particle in meters per second squared. This will be used to randomly vary the acceleration rate of the particle.
This is the maximum acceleration rate that can be added or subtracted from the initial acceleration rate. This will be chosen per particle when emitted and remain constant for the lifetime of the particle.
Default
0particleColorStops
particleColorStops:
ArraySchema<ParticleEmitterColorStop>
Defined in: src/rendering/particles/emitter.ts:373
The color stops for the particle.
This is used to have fine grained control of the particle's color and alpha over its lifetime.
Default
[]particleEmitRatePerSecond
particleEmitRatePerSecond:
number=10
Defined in: src/rendering/particles/emitter.ts:118
This is the number of particles that will be emitted per second.
Default
10particleEmitRatePerSecondVariance
particleEmitRatePerSecondVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:125
The variance in the number of particles that will be emitted per second. This will be used to randomly vary the number of particles emitted per second.
Default
0particleEnableExponentialScaleRate
particleEnableExponentialScaleRate:
boolean=false
Defined in: src/rendering/particles/emitter.ts:346
If this is true, the particle scale rate will be exponential. i.e. the particle will scale by a factor of the scale rate each second.
If this is false, the particle scale rate will be additive. i.e. the particle will scale by the scale rate each second.
Default
falseparticleEndSize
particleEndSize:
number=-1
Defined in: src/rendering/particles/emitter.ts:212
The end size of an emitted particle.
This is the size that the particle will reach at the end of its lifetime.
Set this to a value >= 0 to enable particle size interpolation.
Default
-1particleEndSizeVariance
particleEndSizeVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:221
The variance in the end size of an emitted particle. This will be used to randomly vary the size of the particle.
This is the maximum size that can be added or subtracted from the end size.
Default
0particleLifetimeMs
particleLifetimeMs:
number=1000
Defined in: src/rendering/particles/emitter.ts:104
The lifetime of each particle in milliseconds.
After this time the particle will be removed from the system.
Default
1000particleLifetimeVarianceMs
particleLifetimeVarianceMs:
number=0
Defined in: src/rendering/particles/emitter.ts:111
The variance in the lifetime of each particle in milliseconds. This will be used to randomly vary the lifetime of the particle.
Default
0particleRotateAcceleration
particleRotateAcceleration:
number=0
Defined in: src/rendering/particles/emitter.ts:288
This is the rate at which the particle's rotation will increase in radians per second squared.
Default
0particleRotateAccelerationVariance
particleRotateAccelerationVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:297
This is the variance in the rotation acceleration rate of an emitted particle in radians per second squared. This will be used to randomly vary the rotation acceleration rate of the particle.
This is the maximum rotation acceleration rate that can be added or subtracted from the initial rotation acceleration rate. This will be chosen per particle when emitted and remain constant for the lifetime of the particle.
Default
0particleRotateSpeed
particleRotateSpeed:
number=0
Defined in: src/rendering/particles/emitter.ts:256
This is the speed at which the particle will rotate in radians per second.
Default
0particleRotateSpeedVariance
particleRotateSpeedVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:265
The variance in the rotation speed of an emitted particle in radians per second. This will be used to randomly vary the rotation rate of the particle.
This is the maximum rotation speed that can be added or subtracted from the initial rotation speed. This will be chosen per particle when emitted and remain constant for the lifetime of the particle.
Default
0particleScaleXRate
particleScaleXRate:
number=0
Defined in: src/rendering/particles/emitter.ts:308
This is the rate at which the particle will scale on the x-axis.
If particleEnableExponentialScaleRate is false, the particle will scale by the scale rate each second. i.e. additive
If particleEnableExponentialScaleRate is true, the particle will scale by a factor of the scale rate each second. i.e. multiplicative
Default
0particleScaleXRateVariance
particleScaleXRateVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:317
The variance in the x scale rate of an emitted particle in meters per second. This will be used to randomly vary the scale rate of the particle.
This is the maximum scale rate that can be added or subtracted from the initial scale rate. This will be chosen per particle when emitted and remain constant for the lifetime of the particle.
Default
0particleScaleYRate
particleScaleYRate:
number=0
Defined in: src/rendering/particles/emitter.ts:328
This is the rate at which the particle will scale on the y-axis.
If particleEnableExponentialScaleRate is false, the particle will scale by the scale rate each second. i.e. additive
If particleEnableExponentialScaleRate is true, the particle will scale by a factor of the scale rate each second. i.e. multiplicative
Default
0particleScaleYRateVariance
particleScaleYRateVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:337
The variance in the y scale rate of an emitted particle in meters per second. This will be used to randomly vary the scale rate of the particle.
This is the maximum scale rate that can be added or subtracted from the initial scale rate. This will be chosen per particle when emitted and remain constant for the lifetime of the particle.
Default
0particleSpriteType
particleSpriteType:
number=-1
Defined in: src/rendering/particles/emitter.ts:95
The sprite type of the particle to emit.
This is only used if the particle type is set to ParticleType.SPRITE.
Default
-1particleStartAlpha
particleStartAlpha:
number=1
Defined in: src/rendering/particles/emitter.ts:364
The start alpha of the particle.
This should be a value between 0 and 1 (inclusive).
Default
1particleStartColor
particleStartColor:
number=0xffffff
Defined in: src/rendering/particles/emitter.ts:355
The start color of the particle.
This is a hex color value.
Default
0xffffffparticleStartDirAngle
particleStartDirAngle:
number
Defined in: src/rendering/particles/emitter.ts:169
The initial direction of an emitted particle in radians.
0is rightMath.PIis leftMath.PI / 2is up-Math.PI / 2is down
Default
Math.PI / 2particleStartDirVariance
particleStartDirVariance:
number
Defined in: src/rendering/particles/emitter.ts:178
The variance in the initial direction of an emitted particle in radians. This will be used to randomly vary the direction of the particle.
This is the maximum direction that can be added or subtracted from the initial direction.
Default
Math.PI / 4particleStartOffsetX
particleStartOffsetX:
number=0
Defined in: src/rendering/particles/emitter.ts:228
The initial offset of an emitted particle on the x-axis, from the emitter's position.
Default
0particleStartOffsetXVariance
particleStartOffsetXVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:242
The variance in the initial offset of an emitted particle on the x-axis. This will be used to randomly vary the offset of the particle.
Default
0particleStartOffsetY
particleStartOffsetY:
number=0
Defined in: src/rendering/particles/emitter.ts:235
The initial offset of an emitted particle on the y-axis, from the emitter's position.
Default
0particleStartOffsetYVariance
particleStartOffsetYVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:249
The variance in the initial offset of an emitted particle on the y-axis. This will be used to randomly vary the offset of the particle.
Default
0particleStartRotation
particleStartRotation:
number=0
Defined in: src/rendering/particles/emitter.ts:132
The initial rotation of an emitted particle in radians.
Default
0particleStartRotationVariance
particleStartRotationVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:141
The variance in the initial rotation of an emitted particle in radians. This will be used to randomly vary the rotation of the particle.
This is the maximum rotation that can be added or subtracted from the initial rotation.
Default
0particleStartSize
particleStartSize:
number=0.2
Defined in: src/rendering/particles/emitter.ts:185
The initial size of an emitted particle.
Default
0.2particleStartSizeInterpolationT
particleStartSizeInterpolationT:
number=0
Defined in: src/rendering/particles/emitter.ts:201
A value between 0 and 1 that represents the percentage of the particle's lifetime at which the particle size interpolation should start, between the start and end size.
Default
0particleStartSizeVariance
particleStartSizeVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:194
The variance in the initial size of an emitted particle. This will be used to randomly vary the size of the particle.
This is the maximum size that can be added or subtracted from the initial size.
Default
0particleStartSpeed
particleStartSpeed:
number=3
Defined in: src/rendering/particles/emitter.ts:148
The initial speed of an emitted particle.
Default
3particleStartSpeedVariance
particleStartSpeedVariance:
number=0
Defined in: src/rendering/particles/emitter.ts:157
The variance in the initial speed of an emitted particle. This will be used to randomly vary the speed of the particle.
This is the maximum speed that can be added or subtracted from the initial speed.
Default
0particleType
particleType:
ParticleType=ParticleType.SQUARE
Defined in: src/rendering/particles/emitter.ts:86
The type of particle to emit.
Default
ParticleType.SQUARE_context
static_context:Context
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:30
Inherited from
_definition
static_definition:SchemaDefinition
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:31
Inherited from
_typeid
static_typeid:number
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:29
Inherited from
COMPONENT_ID
readonlystaticCOMPONENT_ID:number=200
Defined in: src/rendering/particles/emitter.ts:52
The unique identifier of the component.
You must set this value to the unique identifier of the component.
This is required to identify the component on an entity, between the client and server.
This should be the same on the client and server across all instances of the same component.
Note
The id must be between 0 and 190 (inclusive), 191 - 255 are reserved for the engine.
Overrides
Accessors
_definition
Get Signature
get
protected_definition():SchemaDefinition
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:44
Returns
SchemaDefinition
Inherited from
Methods
applyFilters()
applyFilters(
client,encodeAll?):number[]
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:62
Parameters
client
any
encodeAll?
boolean
Returns
number[]
Inherited from
assign()
assign(
props):this
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:41
Parameters
props
{ componentId: number; enabled: boolean; gravityScale: number; maxParticles: number; particleAcceleration: number; particleAccelerationVariance: number; particleColorStops: ArraySchema<ParticleEmitterColorStop>; particleEmitRatePerSecond: number; particleEmitRatePerSecondVariance: number; particleEnableExponentialScaleRate: boolean; particleEndSize: number; particleEndSizeVariance: number; particleLifetimeMs: number; particleLifetimeVarianceMs: number; particleRotateAcceleration: number; particleRotateAccelerationVariance: number; particleRotateSpeed: number; particleRotateSpeedVariance: number; particleScaleXRate: number; particleScaleXRateVariance: number; particleScaleYRate: number; particleScaleYRateVariance: number; particleSpriteType: number; particleStartAlpha: number; particleStartColor: number; particleStartDirAngle: number; particleStartDirVariance: number; particleStartOffsetX: number; particleStartOffsetXVariance: number; particleStartOffsetY: number; particleStartOffsetYVariance: number; particleStartRotation: number; particleStartRotationVariance: number; particleStartSize: number; particleStartSizeInterpolationT: number; particleStartSizeVariance: number; particleStartSpeed: number; particleStartSpeedVariance: number; particleType: ParticleType; } | ToJSON<ParticleEmitter>
Returns
this
Inherited from
clone()
clone():
this
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:63
Returns
this
Inherited from
decode()
decode(
bytes,it?,ref?):DataChange<any,string>[]
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:59
Parameters
bytes
number[]
it?
Iterator
ref?
Ref
Returns
DataChange<any, string>[]
Inherited from
deleteByIndex()
protecteddeleteByIndex(index):void
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:67
Parameters
index
number
Returns
void
Inherited from
discardAllChanges()
discardAllChanges():
void
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:65
Returns
void
Inherited from
encode()
encode(
encodeAll?,bytes?,useFilters?):number[]
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:60
Parameters
encodeAll?
boolean
bytes?
number[]
useFilters?
boolean
Returns
number[]
Inherited from
encodeAll()
encodeAll(
useFilters?):number[]
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:61
Parameters
useFilters?
boolean
Returns
number[]
Inherited from
getByIndex()
protectedgetByIndex(index):any
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:66
Parameters
index
number
Returns
any
Inherited from
listen()
listen<
K>(prop,callback,immediate?): () =>boolean
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:58
Client-side: listen for changes on property.
Type Parameters
K
K extends NonFunctionPropNames<ParticleEmitter>
Parameters
prop
K
the property name
callback
(value, previousValue) => void
callback to be triggered on property change
immediate?
boolean
trigger immediatelly if property has been already set.
Returns
Function
Returns
boolean
Inherited from
onChange()
onChange(
callback): () =>void
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:38
Parameters
callback
() => void
Returns
Function
Returns
void
Inherited from
onRemove()
onRemove(
callback): () =>void
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:39
Parameters
callback
() => void
Returns
Function
Returns
void
Inherited from
setDirty()
setDirty<
K>(property,operation?):void
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:51
(Server-side): Flag a property to be encoded for the next patch.
Type Parameters
K
K extends NonFunctionPropNames<ParticleEmitter>
Parameters
property
string representing the property name, or number representing the index of the property.
number | K
operation?
OPERATION
OPERATION to perform (detected automatically)
Returns
void
Inherited from
toJSON()
toJSON():
ToJSON<ParticleEmitter>
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:64
Returns
ToJSON<ParticleEmitter>
Inherited from
is()
staticis(type):boolean
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:33
Parameters
type
DefinitionType
Returns
boolean
Inherited from
onError()
staticonError(e):void
Defined in: node_modules/.pnpm/@colyseus+schema@2.0.35/node_modules/@colyseus/schema/lib/Schema.d.ts:32
Parameters
e
any
Returns
void