Source of: Bouncing Ball with Trail, by Grok Build 0.1
23 lines, no comments ยท 1,963 tokens, written in 14 seconds for $0.0040
1 function setup() {
2 createCanvas(600, 400);
3 }
4
5 let x = 100;
6 let y = 100;
7 let dx = 4;
8 let dy = 3;
9
10 function draw() {
11 background(0, 30);
12 fill(255, 100, 100);
13 noStroke();
14 ellipse(x, y, 40, 40);
15 x += dx;
16 y += dy;
17 if (x >= width || x <= 0) {
18 dx = -dx;
19 }
20 if (y >= height || y <= 0) {
21 dy = -dy;
22 }
23 }