The PerspectiveTransform effect is another effect which tries to simulate 3D. It changes the node's dimensions so it appears to be viewed not from the top to the bottom but at an angle.
The API is slightly awkward—you need to set all four corners of the new image by setting eight coordinates by different method calls:
// chapter8/geometry/PerspectiveDemo.javaPerspectiveTransform pt = new PerspectiveTransform();pt.setUlx(20); // upper-leftpt.setUly(20);pt.setUrx(100); // upper-rightpt.setUry(20);pt.setLlx(0); // lower-leftpt.setLly(120);pt.setLrx(120); // lower-rightpt.setLry(120);
Or use a very long constructor:
PerspectiveTransform pt = new PerspectiveTransform(20, 20, 100, 20, 0, 120, 120, 120);
I've marked ...