Chaining JavaFX effects

Coverflow example by chaining two effects together

Coverflow example by chaining two effects together

Unfortunately, it appears that the only way to chain JavaFX effects together is by using a Group control. (There is a Effect(input1, input2) constructor, but I can’t seem to access it from JavaFX Script, while the Blend effect doesn’t chain effects, but instead applies them in parallel).

To achieve a Coverflow-like look, we apply a reflection effect, then apply a PerspectiveTransform.

import javafx.application.*;
import javafx.scene.geometry.*;
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.effect.*;

    visible: true
    name: "Beginnings of Coverflow"
    closeAction: function() { java.lang.System.exit(0); }
    stage: Stage
        width: 1024 height: 768
        fill: Color.BLACK
            Group { content: [Rectangle
                                    width: 100 height: 100
                                    x: 0 y: 0
                                    fill: Color.WHITE
                                    effect: Reflection { topOffset:1.0 topOpacity:0.50},
                    effect: PerspectiveTransform
                        llx: 10.0  lly: 200.0 ulx: 10.0   uly:  0.0
                        lrx: 100.0 lry: 170.0 urx: 100.0  ury: 10.0