It would be useful if CanvasGradient allowed specifying a spread method, which determines how the gradient is rendered outside the [0.0, 1.0] stop range:
Pad (current default, gradient stop is clamped to [0.0, 1.0])
Repeat (gradient repeats in the same order past the edges, i.e. colors at [1.0, 2.0] would be the same as [0.0, 1.0]
Reflect (gradient colors repeat in reverse past the edges, i.e. colors at [1.0, 2.0] would be the reverse of [0.0, 1.0]
It would be useful if
CanvasGradient
allowed specifying a spread method, which determines how the gradient is rendered outside the [0.0, 1.0] stop range:Pad
(current default, gradient stop is clamped to [0.0, 1.0])Repeat
(gradient repeats in the same order past the edges, i.e. colors at [1.0, 2.0] would be the same as [0.0, 1.0]Reflect
(gradient colors repeat in reverse past the edges, i.e. colors at [1.0, 2.0] would be the reverse of [0.0, 1.0]This would give canvas parity with
spreadMethod
in SVG andSpreadMethod
going back to Flash.