Section 25.8. CanvasGradient: a color gradient for use in a canvas


25.8. CanvasGradient: a color gradient for use in a canvas

Firefox 1.5, Safari 1.3, Opera 9: Object CanvasGradient

25.8.1. Methods


addColorStop( )

Specifies a color and position for the gradient.

25.8.2. Description

A CanvasGradient object represents a color gradient that may be assigned to both the strokeStyle and fillStyle properties of a CanvasRenderingContext2D object. The createLinearGradient( ) and createRadialGradient( ) methods of CanvasRenderingContext2D both return CanvasGradient objects.

Once you have created a CanvasGradient object, use addColorStop( ) to specify what colors should appear at what positions within the gradient. Between the positions you specify, colors are interpolated to create a smooth gradient or fade. Transparent black stops are created implicitly at the start and end points of the gradient.

25.8.3. See Also

CanvasRenderingContext2D.createLinearGradient( )
CanvasRenderingContext2D.createRadialGradient( )



JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net