Source of: Bouncing Color Ball, by Grok 4.3
19 lines, no comments ยท 587 tokens, written in 8 seconds for $0.0016
1 let x, y, vx, vy;
2
3 function setup() {
4 createCanvas(400, 400);
5 x = width / 2;
6 y = height / 2;
7 vx = 3;
8 vy = 2;
9 }
10
11 function draw() {
12 background(220);
13 fill((frameCount % 255), 150, 200);
14 ellipse(x, y, 50, 50);
15 x += vx;
16 y += vy;
17 if (x > width || x < 0) vx *= -1;
18 if (y > height || y < 0) vy *= -1;
19 }