JavaFX Rotate TransitionThis transition is used to apply the rotation transition on the node. It rotates the node along any of the three axes over the specified duration. RotateTransition is represented by the class javafx.animation.RotateTransition. We just need to instantiate this class in order to generate an appropriate RotateTransition. Properties The properties of the class along with their setter methods are described in the following table. Property | Description | Setter Methods |
---|
axis | This is a object type property of the class Point3D. This represents the axis of rotate transition. | setAxis(Point3D value) | byAngle | This is a double type property. This represents the angle by which the object will be rotated. | setByAngle(double value) | duration | This is the object type property of the class Duration. This represents the duration of the rotate transition. | setDuration(Duration value) | fromAngle | It is a double type property. It represents the start Angle of the rotate transition. | setFromAngle(double value) | node | It is an object type property of the class Node. It represents the node on which the rotate transition to be applied. | setNode(Node value) | toAngle | It is a double type property. It represents the stop angle value for the rotate transition. | setToAngle(double value) |
ConstructorsThere are three constructors in the class. - public RotateTransition() : creates the new instance of RotateTransition with the default parameters.
- public RotateTransition(Duration duration) : Creates the new instance of RotateTransition with the specified duration value
- public RotateTransition(Duration duration, Node node): creates the new instance of RotateTransition with the specified duration value and Node on which, it is applied.
ExampleIn the following example, we have made a rectangle rotating along the Z-axis by 360 degree. Output:
|