There will be a time when you will want to modify the shape of your objects into something completely different. You can tediously update positional or dimensional properties one by one, or you can use the Transformation API. This recipe shows you how to use the Transformation API to transform a shape's physical properties declaratively and effortlessly.
Before you can apply transformations to shapes, you must be familiar with the steps required to create simple shapes using JavaFX. See Drawing simple shapes from Chapter 2, Creating JavaFX Applications for background information on creating simple shapes.
The classes for the Transformation API are kept in the package javafx.scene.transform
. You will find several classes there used for different types of transformation, including Rotate, Scale, Shear
, and Translate
.