Coppercube API Documentation
Class AnimatorOnClick
Scene node animator which invokes a callback function when the scene node has been clicked.
Extends
Animator.
Class Overview
AnimatorOnClick(scene, engine, functionToCall, register)
Scene node animator which invokes a callback function when the scene node has been clicked.
Note: In this version, only bounding box checks are working, this will change in one of the next releases.
It works like in this example:
var yourFunction = function(){ alert('your scene node has been clicked!'); } var animator = new AnimatorOnClick(engine.getScene(), engine, yourFunction); yourSceneNode.addAnimator(animator);
- Parameters:
- scene
- {Scene} The scene of the animator.
- engine
- {CopperLicht} an instance of the 3d engine
- functionToCall
- {function} a function which should be called when the scene node has been clicked
- register
- {Boolean} (optional) set to true to prevent registering at the scene using registerSceneNodeAnimatorForEvents
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 AnimatorOnClick, this will return 'onclick'.