To create a Twillex engine and Tweens requires set up, tear down, and frame updates.
Setup and tear-down work as usual in Torque. First, include the Twillex.cs script. (Twillex is written as a single script file.)
exec("<your_path>/Twillex.cs");
Then, create a Twillex engine to run your tweens. For instance
Twillex::create(myTweenEngine);
Where myTweenEngine can be any unique name you prefer. You could even make several engines if you wanted to keep categories of tweens separate.
In Torque2D, it's not possible to get Torque to call an onUpdate() on Twillex objects each frame. (That only works for scene objects and Twillex is not one.) The scene graph will have to be kind and call Twillex::onUpdate(). For example:
function mySceneGraph::onUpdateSceneTick(%this) {
// do all the other stuff also
myTweenEngine.onUpdate();
}
Note that you don't have to call onUpdate() on the individual Tweens, just the Twillex engines.
In Torque3D, there is no scene graph update method. Instead call
myTweenEngine.startUpdates();
This will cause updates every 1/30th of a second. If you prefer slower updates, you can pass in a parameter that specifies milliseconds between updates, such as 60 or 120.
Note that Torque2D users can also use startUpdates() but this author prefers the first method.
Example Use is a page with several examples of creating and using Tweens.
In the end, delete your Twillex objects as usual:
myTweenEngine.delete();