xworker.javafx.scene.paint.LinearGradient.dml Maven / Gradle / Ivy
The LinearGradient class fills a shape with a linear color gradient pattern. The user may specify two or more gradient colors, and this Paint will provide an interpolation between each color.
两种创建方式,优先级如下:
- 如果valueOf属性不为空,那么通过LinearGradient.valueOf()创建。
- 根据属性创建。
]]>
the X coordinate of the gradient axis start point
]]>
the Y coordinate of the gradient axis start point
]]>
the X coordinate of the gradient axis end point
]]>
the Y coordinate of the gradient axis end point
]]>
whether the coordinates are proportional to the shape which this gradient fills
]]>
cycle method applied to the gradient
]]>
Creates a linear gradient value from a string representation.
The format of the string representation is based on JavaFX CSS specification for linear gradient which is
linear-gradient( [ [from <point> to <point>| [ to <side-or-corner>], ]? [ [ repeat | reflect ], ]? <color-stop>[, <color-stop>]+)
where
<side-or-corner> = [left | right] || [top | bottom]
<point> = [ [ <length> <length> ] | [ <percentage> | <percentage> ] ]
<color-stop> = [ <color> [ <percentage> | <length>]? ]
Currently length can be only specified in px, the specification of unit can be omited. Format of color representation is the one used in Color.web(String color). The linear-gradient keyword can be omited. For additional information about the format of string representation, see the CSS Reference Guide.
Examples:
LinearGradient g
= LinearGradient.valueOf("linear-gradient(from 0% 0% to 100% 100%, red 0% , blue 30%, black 100%)");
LinearGradient g
= LinearGradient.valueOf("from 0% 0% to 100% 100%, red 0% , blue 30%, black 100%");
LinearGradient g
= LinearGradient.valueOf("linear-gradient(from 0px 0px to 200px 0px, #00ff00 0%, 0xff0000 50%, 0x1122ff40 100%)");
LinearGradient g
= LinearGradient.valueOf("from 0px 0px to 200px 0px, #00ff00 0%, 0xff0000 50%, 0x1122ff40 100%");
]]>