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
|
- Version:
- 2.1.19
- Source:
Fires:
- ProximityEffect#event:ready
- ProximityEffect#event:redraw
- ProximityEffect#event:reflow
Extends
- EventTarget
Members
[undefined]
Register custom effect
- Source:
accuracy
Get the effect accuracy.
- Source:
accuracy
Set the effect accuracy.
- Source:
attack
Get the effect attack.
- Source:
attack
Set the effect attack.
- Source:
boundary
Get the effect boundary.
- Source:
decay
Get the effect decay.
- Source:
decay
Set the effect decay.
- Source:
direction
Get the effect direction.
- Source:
direction
Set the effect direction.
- Source:
effects
Get the list of effects.
- Source:
invert
Get the invert state.
- Source:
invert
Set the invert state.
- Source:
jitter
Get the jitter value.
- Source:
jitter
Set the jitter value.
- Source:
nodes
Get the list of nodes.
- Source:
nodes
Set the list of nodes.
- Source:
offsetX
Get the global horizontal offset.
- Source:
offsetX
Set the global horizontal offset.
- Source:
offsetY
Get the global vertical offset.
- Source:
offsetY
Set the global vertical offset, in pixels.
- Source:
pointer
Get the last known mouse pointer coordinates, relative to the viewport, in pixels.
- Source:
runoff
Get the effect runoff.
- Source:
runoff
Set the effect runoff.
- Source:
target
Get the current target
- Source:
target
Set the current target
- Source:
threshold
Get the effect threshold.
- Source:
threshold
Set 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
|
|||||||||||||||||||||||||||||
far |
number | Object | The effect value at the furthest distance.
Properties
|
|||||||||||||||||||||||||||||
params |
Object |
<optional> |
An object containing additional effect parameters.
Properties
|
- 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: