Name
CanvasGradient: a color gradient for use in a canvas â Firefox 1.5, Safari 1.3, Opera 9: Object â CanvasGradient
Methods
-
addColorStop( )
Specifies a color and position for the gradient.
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.
See Also
CanvasRenderingContext2D.createLinearGradient(
)
|
CanvasRenderingContext2D.createRadialGradient(
)
|
Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.