Here we show you how to bring motion into you web-page. We'll do this in simple steps.
If you are impatient you may skip the explanation and view the HelloWorld! immediately.
Note that this tutorial assumes that you have already created an App, and a named motion within that App. If you have not, the tutorial App Hello will take you through the steps.
Bringing shared motion into you web page is easy. You'll need:
The app variable will hold your App object, which provide access to your motions. More about the the App object in App Hello.
App initialisation is started by app.init(). When completed, app.run() is executed.
This short piece of code will print the position of the motion to the console whenever the timeupdate event fires. If the motion is paused timeupdate will only fire once. However, if the motion is requested to play, timeupdate will start fireing periodically (5Hz).
All the motions of this application are available in app.motions. You'll get the correct one by supplying its name, as defined in App Info.
To investigate further what you can do with your motions, please have a look at the Motion API.