Name
CanvasGradient.addColorStop() — specifies a color in the gradient
Synopsis
void addColorStop(floatoffset, Stringcolor)
Arguments
offsetA floating-point value in the range 0.0 to 1.0 that represents a fraction between the start and endpoints of the gradient. An offset of 0 corresponds to the start point, and an offset of 1 corresponds to the endpoint.
colorSpecifies the color to be displayed at the specified offset, as a CSS color string. Colors at other points along the gradient are interpolated based on this and any other color stops.
Description
addColorStop() specifies fixed colors within a
gradient. If you specify two or more color stops, the gradient will
smoothly interpolate colors between the stops. Before the first stop,
the gradient will display the color of the first stop. After the last
stop, the gradient will display the color of the last stop. If you
specify only a single stop, the gradient will be one solid color. If you
specify no color stops, the gradient will be uniform transparent
black.
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