Versions Compared

Key

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

Creates a linear gradient between 2 colors.

Properties

Property

Default

Notes

x1

0

 

y1

0

 

x2

100

 

y2

0

 

color1

'black'

 

color2

'white'

 

cycle

false

 

stretch

false

Scales the gradient to fit the Shape's bounds

fit

true

Scales the gradient retaining the aspect ratio

Examples

4 rectangles, each one with a diagonal gradient

Code Block
rect( x: 0, y: 0, width: 100, height: 100 ){
   gradientPaint( x1: 0, y1: 0, x2: 50, y2: 50 )
}
rect( x: 100, y: 0, width: 100, height: 100 ){
   gradientPaint( x1: 50, y1: 0, x2: 0, y2: 50 )
}
rect( x: 0, y: 100, width: 100, height: 100 ){
   gradientPaint( x1: 0, y1: 50, x2: 50, y2: 0 )
}
rect( x: 100, y: 100, width: 100, height: 100 ){
   gradientPaint( x1: 50, y1: 50, x2: 0, y2: 0 )
}

Different settings for fit, stretch and cycle

Code Block
gradientPaint( id: 'g1', x1: 0, y1: 0, x2: 50, y2: 50 )
rect( x: 0, y: 0, width: 100, height: 100, fill: g1 )
circle( cx: 150, cy: 50, radius: 50, fill: g1 )
rect( x: 0, y: 100, width: 200, height: 100, fill: g1 )