Class: Particle

Particle

new Particle()

Creates a new Particle object.
Source:

Extends

Methods

<static> draw()

Updates the corresponding DOM element's style property.
Source:

<static> getCSSText(props) → {string}

Concatenates a new cssText string.
Parameters:
Name Type Description
props Object A map of object properties.
Source:
Returns:
A string representing cssText.
Type
string

afterStep()

Applies additional forces.
Source:

init(world, opt_options=)

Initializes Particle.
Parameters:
Name Type Argument Default Description
world Object An instance of World.
opt_options= Object <optional>
A map of initial properties.
opt_options.width number <optional>
20 Width
opt_options.height number <optional>
20 Height
[opt_options.color Array = [200, 200, 200]] Color.
opt_options.borderWidth number <optional>
this.width / 4 Border width.
opt_options.borderRadius number <optional>
100 The particle's border radius.
opt_options.boxShadowSpread number <optional>
this.width / 4 Box-shadow spread.
opt_options.lifespan number <optional>
50 The max life of the object. Set to -1 for infinite life.
opt_options.life number <optional>
0 The current life value. If greater than this.lifespan, object is destroyed.
{opt_options.fade boolean = true} If true, opacity decreases proportionally with life.
{opt_options.shrink boolean = true} If true, width and height decrease proportionally with life.
opt_options.checkWorldEdges boolean <optional>
false Set to true to check the object's location against the world's bounds.
opt_options.maxSpeed number <optional>
4 Maximum speed.
opt_options.zIndex number <optional>
1 The object's zIndex.
Source: