I am adding some more points in the function createScene() we have made a major change: instead of having a Transform3D object, we use a PositionInterpolator.
Code:
// Create a TransformGroup and easing
var tTrans: TransformGroup = new TransformGroup ();
var easing = new Ease ();
// Create the interpolator that will run the animation
translator = new PositionInterpolator (easing.create (), 100, new Vector (-150,0,0), new Vector (150,0,0));
// The interpolator is inserted into the TransformGroup
tTrans.setTransform (translation);
// The pyramid is inserted into the translation
tTrans.addChild (pyramid);
// The TransformGroup is added to the main group
bg.addChild (tTrans);
The interpolator uses the movement of the object created easing, has a duration of 100 frames and provides that the animation starts from the point -150,0,0 and end point 150,0,0. It will therefore be a move in a straight line on the X axis. Note how the interpolator is inserted in the TransformGroup tTrans, so each frame to calculate the new position of the group and its objects.
Bookmarks