Class: Attractor

Attractor

new Attractor()

Creates a new Attractor object.
Source:

Extends

Methods

<static> draw()

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

<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

<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

attract(obj) → {Object}

Calculates a force to apply to simulate attraction/repulsion on an object.
Parameters:
Name Type Description
obj Object The target object.
Source:
Returns:
A force to apply.
Type
Object

init(world, opt_options=)

Initializes an instance of Attractor.
Parameters:
Name Type Argument Default Description
world Object An instance of World.
opt_options= Object <optional>
A map of initial properties.
opt_options.G number <optional>
10 Universal Gravitational Constant.
opt_options.mass number <optional>
1000 Mass. Increase for a greater gravitational effect.
opt_options.isStatic boolean <optional>
true If true, object will not move.
opt_options.width number <optional>
100 Width.
opt_options.height number <optional>
100 Height.
opt_options.color Array <optional>
92, 187, 0 Color.
opt_options.borderWidth number <optional>
this.width / 4 Border width.
opt_options.borderStyle string <optional>
'double' Border style.
opt_options.borderColor Array <optional>
224, 228, 204 Border color.
opt_options.borderRadius number <optional>
100 Border radius.
opt_options.boxShadowSpread number <optional>
this.width / 4 Box-shadow spread.
opt_options.boxShadowColor Array <optional>
92, 187, 0 Box-shadow color.
opt_options.opacity number <optional>
0.75 The object's opacity.
opt_options.zIndex number <optional>
1 The object's zIndex.
Source: