Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Generated Object

javafx.scene.paint.LinearGradient

Attributes

This node takes the attributes of the javafx.scene.paint.LinearGraident class. see javafx.scene.paint.LinearGradient

In addition, it takes the following attributes:

start - a list of 2 elements with the first value used to set the startX attribute of the LinearGradient and the second value to set the startY attribute.

end - a list of 2 elements with the first value used to set the endX attribute of the LinearGradient and the second value to set the endY attribute.

stops - The value of the stops attribute should be a List of 2-element Lists containing an offset and color: [[0.0, black], [1.0, red]]

Content

This node may optionally take one or more stop nodes as content. see Scenegraph.stop

Usage

This node creates a javafx.scene.paint.LinearGradient. 

Examples

Code Block
import groovyx.javafx.GroovyFX;
import groovyx.javafx.SceneGraphBuilder

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

    sg.stage(title: "Gradient Example (GroovyFX)", width: 1020, height: 450, visible: true) {
        scene(fill: linearGradient(endX: 0, stops: [[0.0, white], [1.0, lightgray]])) {

            def width = 240
            def height = 180

            rectangle(width: width, height: height,
                fill: linearGradient(stops:[[0.0, red],[1.0, black]]),
                stroke: linearGradient(stops: [[0.0, blue], [1.0,red]]),
                strokeWidth: 10 )

        }
    }
});