/*
* This PropertySetter enables the animation for the car movement all the
* way around the track.
*/
final TimingTarget modifier = PropertySetter.getTarget(basicGUI.getTrack(), "carPosition", keyFrames);
animator.addTarget(modifier);
/*
* Now create similar keyframes for rotation of car.
*/
int[] rotationKeyValues = { 360, 315, 270, 225, 180, 135, 90, 45, 0 };
Interpolator straightawayTurnSpline = new SplineInterpolator(1.0f, 0.0f, 1.0f, 0.0f);
Interpolator curveTurnSpline = new SplineInterpolator(0.0f, 0.5f, 0.5f, 1.0f);
Interpolator[] rotationInterps = { null, straightawayTurnSpline, curveTurnSpline, straightawayTurnSpline, curveTurnSpline,
straightawayTurnSpline, curveTurnSpline, straightawayTurnSpline, curveTurnSpline };
final KeyFrames.Builder<Integer> rotationBuilder = new KeyFrames.Builder<Integer>(rotationKeyValues[0]);
for (int i = 1; i < values.length; i++) {
rotationBuilder.addFrame(rotationKeyValues[i], times[i], rotationInterps[i]);
}
KeyFrames<Integer> rotationKeyFrames = rotationBuilder.build();
final TimingTarget rotationModifier = PropertySetter.getTarget(basicGUI.getTrack(), "carRotation", rotationKeyFrames);
animator.addTarget(rotationModifier);
/*
* Finally, add sound effects, triggered by the same animator.
*/