Class: ProximityEffect

ProximityEffect(nodes, paramsopt)

Class representing a ProximityEffect.

Constructor

new ProximityEffect(nodes, paramsopt)

Create a ProximityEffect instance.
Parameters:
Name Type Attributes Default Description
nodes NodeList A list of nodes to control.
params Object <optional>
{} An object containing effect parameters.
Properties
Name Type Attributes Default Description
threshold number <optional>
0 The effect threshold, in pixels.
runoff number <optional>
The effect runoff, in pixels.
attack number <optional>
1 The effect attack.
decay number <optional>
1 The effect decay.
accuracy number <optional>
The effect accuracy.
invert boolean <optional>
false Invert distances.
offsetX number <optional>
0 The global horizontal offset, in pixels.
offsetY number <optional>
0 The global vertical offset, in pixels.
jitter number <optional>
0 The effect jitter, in pixels.
direction string <optional>
"both" The effect direction, one of 'both', 'horizontal' or 'vertical'.
target Element <optional>
The effect tracker target.
doPresetDistances boolean <optional>
false Prime the initial distances to create an initial transition. Only available through params argument in constructor.
Source:

Extends

  • EventTarget

Members

accuracy

Get the effect accuracy.
Source:

accuracy

Set the effect accuracy.
Source:

attack

Set the effect attack.
Source:

attack

Get the effect attack.
Source:

boundary

Get the effect boundary.
Source:

decay

Set the effect decay.
Source:

decay

Get the effect decay.
Source:

direction

Set the effect direction.
Source:

direction

Get the effect direction.
Source:

effects

Get the list of effects.
Source:

invert

Set the invert state.
Source:

invert

Get the invert state.
Source:

jitter

Set the jitter value.
Source:

jitter

Get the jitter value.
Source:

nodes

Get the list of nodes.
Source:

nodes

Set the list of nodes.
Source:

offsetX

Set the global horizontal offset.
Source:

offsetX

Get the global horizontal offset.
Source:

offsetY

Set the global vertical offset, in pixels.
Source:

offsetY

Get the global vertical offset.
Source:

pointer

Get the last known mouse pointer coordinates, relative to the viewport, in pixels.
Source:

runoff

Set the effect runoff.
Source:

runoff

Get the effect runoff.
Source:

target

Set the current target
Source:

target

Get the current target
Source:

threshold

Set the effect threshold.
Source:

threshold

Get the effect threshold.
Source:

Methods

addEffect(name, near, far, paramsopt)

Add a new effect to the effect stack.
Parameters:
Name Type Attributes Description
name string The effect name.
near number | Object The effect value at the closest distance.
Properties
Name Type Attributes Description
value number The effect value at closest distance, as an object property.
scatter number <optional>
The random distribution of the value at the closest distance.
scatterMethod string <optional>
The random scatter method.
far number | Object The effect value at the furthest distance.
Properties
Name Type Attributes Description
value number The effect value at furthest distance, as an object property.
scatter number <optional>
The random distribution of the value at the furthest distance.
scatterMethod string <optional>
The random scatter method.
params Object <optional>
An object containing additional effect parameters.
Properties
Name Type Attributes Description
rule string <optional>
The CSS style rule to use.
func string <optional>
The CSS function of the given style rule.
min number <optional>
The minimum effect value.
max number <optional>
The maximum effect value.
default number <optional>
The default effect value.
unit string <optional>
The effect CSS unit.
Source:

distanceFrom(n)

Get the distance to the current target from the given node, in pixels.
Parameters:
Name Type Description
n Element The node to check.
Source:

distanceFromIndex(i)

Get the distance to the current target from the given node index, in pixels.
Parameters:
Name Type Description
i number The node index to check.
Source:

getNodeData(n, propopt) → {mixed|NodeData}

Return an object containing the given node's effect data or a specific property of that data.
Parameters:
Name Type Attributes Description
n Element The node to return data for.
prop string <optional>
The data property to return, leave out to return the entire object.
Source:
Returns:
The chosen property value, or an object containing the node's data.
Type
mixed | NodeData

getNodeIndexData(i, prop) → {Object}

Return an object containing the given node index's effect data.
Parameters:
Name Type Description
i number The node index to return data for.
prop string The data property to return.
Source:
Returns:
True if the property exists, false otherwise.
Type
Object

hasEffect(name) → {boolean}

Check if a named effect is already on the stack.
Parameters:
Name Type Description
name string The name of the effect to check for.
Source:
Returns:
True if the effect exists at least once.
Type
boolean

hasNodeIndexData(i, prop) → {boolean}

Return a boolean determining if the given node has thegiven data.
Parameters:
Name Type Description
i number The node index to return data for.
prop string The data property to return.
Source:
Returns:
An object containing the node's data.
Type
boolean

removeEffect(name)

Remove all instances of an effect from the stack.
Parameters:
Name Type Description
name string The name of the effect to remove.
Source:

setCenterPoints()

Recalculate each node's centre point, including global offset and jitter.
Source: