package test; import javafx.animation.Animation; import javafx.animation.Interpolator; import javafx.animation.RotateTransition; import javafx.application.Application; import javafx.geometry.VPos; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.util.Duration; public class TextRotation extends Application { @Override public void start(Stage stage) { stage.setTitle("Text Rotation"); Group root = new Group(); Scene scene = new Scene(root, 300, 300); Text textA = new Text("A"); textA.setFill(Color.RED); textA.setFont(new Font(50)); textA.setTextOrigin(VPos.TOP); Group parent = new Group(); parent.setTranslateX(100); parent.setTranslateY(100); // This works // RotateTransition rt = new RotateTransition(Duration.seconds(4), textA); // This doesn't RotateTransition rt = new RotateTransition(Duration.seconds(4), parent); rt.setAutoReverse(false); rt.setFromAngle(0); rt.setToAngle(360); rt.setInterpolator(Interpolator.LINEAR); rt.setCycleCount(Animation.INDEFINITE); rt.play(); parent.getChildren().addAll(textA); root.getChildren().add(parent); stage.setScene(scene); stage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { Application.launch(args); } }