Physics

Changing the transformation matrix manually is pretty clumsy. If you want to setup some constant animation then you can apply physics to a scene node. To do this you create a new instance of the class twodee.Physics and apply it to the scene node (or multiple nodes) by passing the physics object to the setPhysics() method of the scene node:

var physics = new twodee.Physics();
node.setPhysics(physics);     

Now you can call various methods to change the physics of the node (or nodes). Here is a list of the most important methods (See API doc for a full list of methods):

This small example shows an asteroid with an applied spin:

<<< Previous: Transformations | Next: Collisions >>>