-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathsimple.pde
40 lines (34 loc) · 926 Bytes
/
simple.pde
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
// some simple drawing & line effects
// store current line values
int lineX = 0;
int lineY = 0;
// set up screen
void setup(){
// set up screen, color mode, & background
size(300, 300);
colorMode(RGB, 100);
smooth();
frameRate(45);
background(97);
// display two shapes to permanently leave on the screen
fill(100, 60, 75, 75);
stroke(50, 30, 100, 75);
ellipse(75, 75, 45, 30);
fill(50, 30, 100, 75);
stroke(100, 60, 75, 75);
rect(100, 100, 100, 75);
}
// shows all the possible paths where the mouse moves to draw a new line
// selects random colors over time
void draw(){
stroke(random(1, 100), random(1, 100), random(1, 100), 3);
line(lineX, lineY, mouseX, mouseY);
}
// when clicking the mouse, draw a new line to connect to the previous one
void mousePressed(){
stroke(100, 65, 5);
fill(100, 65, 6);
line(lineX, lineY, mouseX, mouseY);
lineX = mouseX;
lineY = mouseY;
}