The context object within an HTML5 canvas can determain colors for lines and shapes and shadows and gradients.
To set the line color in and HTML5 canvas, use the below JavaScript syntax:
cont.strokeStyle = "#FF0000";
To set the fill style for shapes drawn, use the following syntax:
cont.fillStyle = "#0000FF";
To create a gradient, use the following code:
var gradientObject = cont.createLinearGradient(55 ,55, 220, 220);
gradientObject.addColorStop(0, "#FFFF00");
gradientObject.addColorStop(1, "#00FFFF");
This code above specifies the dimensions and position of the gradient area, and the two values, indicate the colors at both ends of the gradient.
HTML5 Canvas Colors
The context object within an HTML5 canvas can determain colors for lines and shapes and shadows and gradients....
html5 canvas colors
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users