Untitled
unknown
plain_text
a year ago
659 B
30
Indexable
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
const colors = ["#ff0000",
"#00ff00",
"#0000ff",
"#ffff00",
"#ff00ff"]
const randomColor = colors[Math.floor(Math.random() * colors.length)]
const randomColor2 = colors[Math.floor(Math.random() * colors.length)]
x = screenX;
y = screenY;
let isDrawing = true;
function draw() {
if (isDrawing = true) {
x = 20
y += 20
}
ctx.beginPath(),
ctx.arc(x, y, 10, 0, 2 * Math.PI),
ctx.stroke(),
ctx.fillStyle = (randomColor),
ctx.fill()
}
draw()
setInterval(draw, 500)Editor is loading...
Leave a Comment