Re: how to use jit.anim.drive and jit.anim.node in javascript


Forums > Javascript > how to use jit.anim.drive and jit.anim.node in javascript
June 13, 2012 | 7:58 pm

hello. thanks for the questions.

there is currently some limitations to using the animation objects inside of javascript. these should all be gone in a future update.

for now, your best bet is to leave the jit.anim.drive outside of javascript, and create an "anything" function to pass messages from the max-box jit.anim.drive, to the javascript jit.anim.node. (this technique is found in the javascript example patch here: Max6/examples/jitter-examples/javascript/other/jitternotify.js)

to set up an anim.node hierarchy inside of javascript, you can create an array of gl objects and an array of anim.node objects, and set the "anim" attribute of the gl object to the "name" attribute of the anim.node.
you then can create a parent anim.node object, and set the "anim" attribute of the child anim.node objects to the "name" attribute of the parent.

you can then pass messages from the anim.drive (or any kind of message) to this parent anim.node.

here’s a basic patch with javascript to demonstrate.
please let me know if anything is unclear.

– Pasted Max Patch, click to expand. –