Class TranslateTransition

java.lang.Object
javafx.animation.Animation
javafx.animation.Transition
javafx.animation.TranslateTransition

public final class TranslateTransition extends Transition
This Transition creates a move/translate animation that spans its duration. This is done by updating the translateX, translateY and translateZ variables of the node at regular intervals.

It starts from the (fromX, fromY, fromZ) value if provided else uses the node's (translateX, translateY, translateZ) value.

It stops at the (toX, toY, toZ) value if provided else it will use start value plus (byX, byY, byZ) value.

The (toX, toY, toZ) value takes precedence if both ( toX, toY, toZ) and (byX, byY, byZ) values are specified.

Code Segment Example:

 
 import javafx.scene.shape.*;
 import javafx.animation.*;

 ...

     Rectangle rect = new Rectangle (100, 40, 100, 100);
     rect.setArcHeight(50);
     rect.setArcWidth(50);
     rect.setFill(Color.VIOLET);

     TranslateTransition tt = new TranslateTransition(Duration.millis(2000), rect);
     tt.setByX(200f);
     tt.setCycleCount(4f);
     tt.setAutoReverse(true);

     tt.play();

 ...

 
 
Since:
JavaFX 2.0
See Also: