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(
)
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access