canvas colour changing js code example
Example: how to change canvas color in javascript
let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d");
ctx.fillStyle = "#ff0000";
ctx.fillRect(20, 20, 150, 100);
let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d");
ctx.fillStyle = "#ff0000";
ctx.fillRect(20, 20, 150, 100);