Particle

View source

Marks an entity as a particle.

Particle is an empty marker component with no fields or constructor options. Pair it with a Timer when representing a particle with a lifetime; the emitter integration uses the marker and timer to identify particles whose lifetime has completed.

There is no state to copy: copy(source, target) returns the supplied target unchanged, while clone(source) creates another empty marker.

Examples

import { World } from '@wimaengine/ecs'
import { Particle } from '@wimaengine/emitter'

const world = new World()
const particle = world.spawn([new Particle()])

Constructor


constructor()

Methods


staticcopy(source: Particle, target?: Particle): Particle

View source

Returns a marker target without copying any state.

Parameters

NameDescriptionDefault
source

Marker source; it has no state to read.

—
target?

Marker to return unchanged.

...

Returns

The supplied target, or a new empty marker.

staticclone(target: Particle): Particle

View source

Creates an empty marker because there is no state to clone.

Parameters

NameDescriptionDefault
target

Marker source; it is not read.

—

Returns

A new empty marker.