-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathfour_sections.pde
More file actions
35 lines (30 loc) · 731 Bytes
/
four_sections.pde
File metadata and controls
35 lines (30 loc) · 731 Bytes
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
// Four sections
// The Coding Train / Daniel Shiffman
// Processing Intro Series
void setup() {
size(640, 360);
pixelDensity(2);
}
void draw() {
background(0);
stroke(255);
fill(175);
rectMode(CENTER);
//Check the mouseY position to determine what's displayed!
//Draw each shape within the row that evaluates to true
if (mouseY < 90) {
line(250, 45-35, 350, 45+35);
} else if (mouseY < 180) {
square(300, 135, 70);
} else if(mouseY < 270){
rect(300, 225, 150, 35, 5);
}else {
circle(300, 315, 70);
}
stroke(127);
strokeWeight(4);
//Draw horizontal lines
line(0, 90, width, 90);
line(0, 180, width, 180);
line(0, 270, width, 270);
}