The recipe for using Interpolator and Alpha objects is very similar to using any behavior object. The major difference from the behavior usage recipe is to include the Alpha object.
public BranchGroup createSceneGraph() {
// Create the root of the branch graph
BranchGroup objRoot = new BranchGroup();
// 1. create target TransformGroup with Capabilities
TransformGroup objSpin = new TransformGroup();
objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// 2. create Alpha that continuously rotates with a period of 1 minute Alpha alpha = new Alpha (-1, 60000);
// 3. create interpolator object; by default: full rotation about y-axis RotationInterpolator rotInt = new RotationInterpolator(alpha, objSpin); // 4. add scheduling bounds rotInt.setSchedulingBounds(new BoundingSphere());
// 5. assemble scene graph
objRoot.addChild(objSpin);
objSpin.addChild(new Clock());
objRoot.addChild(rotInt);
// Let Java 3D perform optimizations on this scene graph.
objRoot.compile();
return objRoot;
} // end of CreateSceneGraph method of ClockApp