<!doctype html>
<html>
<head>
<title>canvasExample</title>
<meta charset='utf-8' />
</head>
<body onload="setInterval('mainfunc()', 10)">
<canvas height='1000' width='1000' id='example'></canvas>
<script>
let y = 200;
function mainfunc(){
let example = document.getElementById("example"),
ctx = example.getContext('2d');
for (let x = 0; x < 3600;x+=0.1)
{
ctx.fillStyle = '#' + Math.floor(Math.random()*16777215).toString(16);
ctx.fillRect(x+200,y,Math.floor(Math.random() * 200),Math.floor(Math.random() * 200));
}
}
</script>
</body>
</html>
|