Applying Transformations in JavaFX

Previous
Next

4 Shearing

A shearing transformation rotates one axis so that the x-axis and y-axis are no longer perpendicular. The coordinates of the node are shifted by the specified multipliers.

To shear, use the Shear class or the shear function of the Transform class.

In the Xylophone application, you can shear the xylophone by dragging the mouse while holding Shift and pressing the left mouse button.

Figure 4-1 Shearing Transformation

Description of Figure 4-1 follows
Description of "Figure 4-1 Shearing Transformation"

Example 4-1 shows the code snippet for the shear transformation.

Example 4-1 Shearing

else if (me.isShiftDown() && me.isPrimaryButtonDown()) {
    double yShear = shear.getY();
    shear.setY(yShear + mouseDeltaY/1000.0);
    double xShear = shear.getX();
    shear.setX(xShear + mouseDeltaX/1000.0);
}
Previous
Next