It's pretty simple to use:
%tween = new Tween(){
Duration = 5; // This is in seconds.
Target = SimpleWall; // Any SimObject.
ValueName = "x"; // Syntactic sugar for the x-coordinate.
ValueTarget = "5"; // The destination value, this is the absolute value. No relative supported atm.
EaseDirection = $Ease::Out; // This is just the stock easing values.
EaseType = $Ease::Circular; // Again, this is a stock thing, I didn't implement the $Ease enum.
};
%tween.play();
There is syntactic sugar for:
Position (x, y, z).
Rotation(rx, ry, rz).
Scale(sx, sy, sz).
But any numerical field that is accessible through TorqueScript can be used. (Includes globals).
The Tween class has the following methods:
- Play - Starts the tween
- Pause - Pauses the tween
- Rewind - Rewinds the tween back to the beginning (does not stop it currently)
- Reverse - Plays the tween in reverse
And an "onFinished" callback.
The code is not completely finished, but it's fun to play with!