429

Creating interpolator behaviors
RotationInterpolator example code

  • Create a TransformGroup to animate
    TransformGroup myGroup = new TransformGroup( );

  • Create an alpha generator
    Alpha upRamp = new Alpha( );
    upRamp.setIncreasingAlphaDuration( 10000 );
    upRamp.setLoopCount( -1 );  // loop forever

  • Create and set up a rotation interpolator
    RotationInterpolator mySpinner = new RotationInterpolator( upRamp, myGroup );
    mySpinner.setAxisOfRotation( new Transform3D( ) );
    mySpinner.setMinimumAngle( 0.0f );
    mySpinner.setMaximumAngle( (float)(Math.PI * 2.0) );

  • Set the scheduling bounds and add it to the scene
    mySpinner.setSchedulingBounds( bounds );
    myGroup.addChild( spinner );