Generated Object

javafx.scene.effect.DisplacementMap

Attributes

This node takes the attributes of the javafx.scene.effect.DisplacementMap class, see javafx.scene.effect.DisplacementMap.

Content

An optional Effect may be provides that is used as input to the DisplacementMap effect.

Usage

Creates a DisplacementMap effect applied to a JavaFX Node.

Examples

GroovyFX.start({
def sg = new SceneGraphBuilder(it);

FloatMap mapData = new FloatMap();
mapData.setWidth(220);
mapData.setHeight(100);

for (int i = 0; i < 220; i++) {
    double v = (Math.sin(i / 50.0 * Math.PI) - 0.5) / 40.0;
    for (int j = 0; j < 100; j++) {
        mapData.setSamples(i, j, 0.0f, (float) v);
    }
}


sg.stage(
    title: "DisplacementMap Effect Example",
    x: 100, y: 100, width: 400, height:400,
    visible: true,
    style: "decorated",
) {

    scene(fill: hsb(128, 0.5, 0.5, 0.5) ) {
        text(content: "Blurry Text!", fill: "red", font: "bold 36pt", x: 10, y: 10, textOrigin: "top") {
            displacementMap(mapData: mapData)
        }
    }
}

});