Creates a radial gradient of many colors. It accepts transformations too.
Requires graphicsbuilder-ext-jdk6 and Java6+.
Properties
| Property | Default | Notes |
|---|---|---|
| cx | ||
| cy | ||
| fx | will take the value of cx if not defined | |
| fy | will take the value of cy if not defined | |
| radius | ||
| absolute | false | flag for moving the center relative to the Shape or not |
| cycle | 'nocycle' | value must be any of ['nocycle','reflect','repeat] or any MultipleGradientPaint.CycleMethod |
| stops | [] | must define at least two stops |
| linkTo | a reference to a radialGradient or a linearGradient |
If linkTo is used, then this gradient will reuse the referenced one's stops, new stops may be added to this gradient though.
Stops
| Property | Default | Notes |
|---|---|---|
| offset | a float value in the range [0..1] | |
| color | a Color or a color string | |
| opacity | must be in the range [0..1] |
Example
def stops = {
def offsets = [0,0.5,1]
def colors = ['black','red','blue']
(0..2).each{ stop( offset: offsets[it], color: colors[it] ) }
}
rect( x: 0, y: 0, width: 100, height: 100 ){
radialGradient( cx: 25, cy: 25, radius: 75 ){ stops() }
}
rect( x: 25, y: 100, width: 100, height: 100 ){
radialGradient( cx: 25, cy: 125, radius: 75, absolute: true ){ stops() }
}

Labels
(None)