Spaces:
Sleeping
Sleeping
Commit
·
3e79ae9
1
Parent(s):
9785afb
more tests
Browse files- index.html +4 -3
index.html
CHANGED
|
@@ -90,23 +90,24 @@
|
|
| 90 |
|
| 91 |
function draw() {
|
| 92 |
// Clear the canvas and fill with background color
|
| 93 |
-
ctx.fillStyle = '
|
| 94 |
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
| 95 |
|
| 96 |
// Draw all circles
|
| 97 |
circles.forEach(circle => {
|
| 98 |
ctx.beginPath();
|
| 99 |
ctx.arc(circle.x, circle.y, 100, 0, Math.PI * 2); // Radius of 50
|
| 100 |
-
ctx.fillStyle = circle.color || '
|
| 101 |
ctx.fill();
|
| 102 |
ctx.closePath();
|
| 103 |
});
|
|
|
|
| 104 |
|
| 105 |
animationId = requestAnimationFrame(draw);
|
| 106 |
}
|
| 107 |
|
| 108 |
function addCircle(x, y, id) {
|
| 109 |
-
circles.push({ id, x, y, color: '
|
| 110 |
resetTimer();
|
| 111 |
updateStatusText(`Circle added: ${id}`);
|
| 112 |
}
|
|
|
|
| 90 |
|
| 91 |
function draw() {
|
| 92 |
// Clear the canvas and fill with background color
|
| 93 |
+
ctx.fillStyle = '#add8e6';
|
| 94 |
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
| 95 |
|
| 96 |
// Draw all circles
|
| 97 |
circles.forEach(circle => {
|
| 98 |
ctx.beginPath();
|
| 99 |
ctx.arc(circle.x, circle.y, 100, 0, Math.PI * 2); // Radius of 50
|
| 100 |
+
ctx.fillStyle = circle.color || '#fff';
|
| 101 |
ctx.fill();
|
| 102 |
ctx.closePath();
|
| 103 |
});
|
| 104 |
+
updateStatusText(`Draw: ${circles.length}`);
|
| 105 |
|
| 106 |
animationId = requestAnimationFrame(draw);
|
| 107 |
}
|
| 108 |
|
| 109 |
function addCircle(x, y, id) {
|
| 110 |
+
circles.push({ id, x, y, color: '#fff' });
|
| 111 |
resetTimer();
|
| 112 |
updateStatusText(`Circle added: ${id}`);
|
| 113 |
}
|