Class PerspectiveTransform

java.lang.Object
javafx.scene.effect.Effect
javafx.scene.effect.PerspectiveTransform

public class PerspectiveTransform extends Effect
An effect that provides non-affine transformation of the input content. Most typically PerspectiveTransform is used to provide a "faux" three-dimensional effect for otherwise two-dimensional content.

A perspective transformation is capable of mapping an arbitrary quadrilateral into another arbitrary quadrilateral, while preserving the straightness of lines. Unlike an affine transformation, the parallelism of lines in the source is not necessarily preserved in the output.

Note that this effect does not adjust the coordinates of input events or any methods that measure containment on a Node. The results of mouse picking and the containment methods are undefined when a Node has a PerspectiveTransform effect in place.

Example:


 PerspectiveTransform perspectiveTrasform = new PerspectiveTransform();
 perspectiveTrasform.setUlx(10.0);
 perspectiveTrasform.setUly(10.0);
 perspectiveTrasform.setUrx(310.0);
 perspectiveTrasform.setUry(40.0);
 perspectiveTrasform.setLrx(310.0);
 perspectiveTrasform.setLry(60.0);
 perspectiveTrasform.setLlx(10.0);
 perspectiveTrasform.setLly(90.0);

 Group g = new Group();
 g.setEffect(perspectiveTrasform);
 g.setCache(true);

 Rectangle rect = new Rectangle();
 rect.setX(10.0);
 rect.setY(10.0);
 rect.setWidth(280.0);
 rect.setHeight(80.0);
 rect.setFill(Color.web("0x3b596d"));

 Text text = new Text();
 text.setX(20.0);
 text.setY(65.0);
 text.setText("Perspective");
 text.setFill(Color.ALICEBLUE);
 text.setFont(Font.font(null, FontWeight.BOLD, 36));

 g.getChildren().addAll(rect, text);
 

The code above produces the following:

The visual effect of
 PerspectiveTransform on text

Since:
JavaFX 2.0