<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="900" height="900" style="border:1px solid
#d3d3d3;">
</canvas>
<script>
let c = document.getElementById("myCanvas");
let ctx = c.getContext("2d");
ctx.clearRect(0,0,900,900);
let size = 0;
let y = 0;
let counter = 0;
setInterval(function() {
ctx.fillStyle = "red";
ctx.fillRect(0,y,size,20);
y = y + 30;
ctx.fillStyle = "green";
ctx.font = "30px Arial";
ctx.fillText(String(counter)+"%",y-size/2,y+20);
size = size + 20;
counter = counter +1;
}, 100);
</script>
</body>
</html>
|