-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.js
49 lines (38 loc) · 854 Bytes
/
code.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Declare variable for the horizontal position of the circle
let x = 25;
function setup() {
// Create the canvas
createCanvas(720, 400);
// Set the color mode to hue-saturation-brightness (HSB)
colorMode(HSB);
// Set the text size
textSize(20);
// No animation to start
noLoop();
}
function draw() {
// Clear the background
background(0);
// Draw a circle, with hue determined by frameCount
fill(x / 3, 90, 90);
circle(x, height / 2, 50);
// Increase the x variable by 5
x += 5;
// Reset the circle position after it moves off the right side
if (x > width + 25) {
x = -25;
}
describe('circle moving to the right');
}
function mousePressed() {
// Start/stop the animation loop
if (isLooping()) {
noLoop();
} else {
loop();
}
}
function keyPressed() {
// Draw one frame
redraw();
}