Canvas Tutorials

Canvas Methods and Properties

HTML canvas addColorStop() Method

HTML canvas addColorStop() Method



The addColorStop() method is used to specify color and position in a gradient object. It is used together with createLinearGradient() or createRadialGradient().




Its syntax is:- gradient.addColorStop(stop, color);


Further Explanation:-


Parameter Description
stop A value between 0.0 and 1.0 that represents the position between start and end in a gradient
color A CSS color value to display at the stop position

Code Explanation

All Tutorials related to Canvas Methods and Properties

All Sections related to Canvas