Coppercube API Documentation
Class AnimatorOnProximity
Scene node animator which invokes a callback function when the scene node gets near another scene node.
Extends
Animator.
Class Overview
AnimatorOnProximity(scene, radius, idOfSceneNode, functionToCall, triggerOnLeave)
Scene node animator which invokes a callback function when the scene node gets near another scene node.
It works like in this example:
var yourFunction = function(){ alert('now near your scene node!'); } var animator = new AnimatorOnProximity(engine.getScene(), 100, 34534, yourFunction, false); yourSceneNode.addAnimator(animator);
- Parameters:
- scene
- {Scene} the current scene
- radius
- {Number} the proximity radius to use
- idOfSceneNode
- {Number} The unique id (see SceneNode.id of the scene node which will trigger this
- functionToCall
- {function} a function which should be called when the scene node has been clicked
- triggerOnLeave
- {Boolean} set to false to let this trigger when the radius is entered, to true if when the radius is left
Method Attributes | Method Name and Description |
---|---|
animateNode(n, timeMs)
Animates the scene node it is attached to and returns true if scene node was modified.
|
|
getType()
Returns the type of the animator.
|
- Methods borrowed from class Animator:
- onKeyDown, onKeyUp, onMouseDown, onMouseMove, onMouseUp, onMouseWheel
Method Detail
animateNode(n, timeMs)
Animates the scene node it is attached to and returns true if scene node was modified.
- Parameters:
- n
- The Scene node which needs to be animated this frame.
- timeMs
- The time in milliseconds since the start of the scene.
getType()
Returns the type of the animator.
For the AnimatorOnProximity, this will return 'oncollide'.