<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="500" height="500" style="border:1px solid #d3d3d3;">
</canvas>
<script>
let canvas= document.getElementById("myCanvas");
let ctx = canvas.getContext("2d");
let y1 = 25;
for (let i = 0; i < 250;i++){
y1 = y1 + 25;
for (let z = 0; z < 25;z++){
let randomColor = Math.floor(Math.random()*16777215).toString(16);
ctx.fillStyle = '#'+randomColor;
ctx.beginPath();
let x1 = Math.random()*100*i+50;
ctx.arc(x1,y1,25,0,Math.PI*2);
ctx.fill();
}
}
</script>
</body>
</html>
|