-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLesson 1 - Basics of P5.js
91 lines (66 loc) · 1.57 KB
/
Lesson 1 - Basics of P5.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
function setup() {
createCanvas(500, 500);
//Draws the sky as the background
background(121, 186, 242);
}
function draw() {
//Drawing the sun before the rest so it gets cut in half
noStroke();
//Sets yellow colour
fill(242, 226, 5);
//Sun
ellipse(100, 250, 75, 75);
//Sun rays
//Coordinates for the sunrays were made from trial and error so they are not the same length or spaced evenly
//yellow colour and stroke weight for the rays
stroke(242, 226, 5);
strokeWeight(1);
//First 2 opposite lines
line(100, 245, 45, 245);
line(100, 245, 155, 245);
//Second Pair
line(100, 245, 50, 230);
line(100, 245, 150, 230);
//Third pair
line(100, 245, 57, 215);
line(100, 245, 143, 215);
//Fourth pair
line(100, 245, 70, 205);
line(100, 245, 130, 205);
//Fith pair
line(100, 245, 86, 198)
line(100, 245, 114, 198);
//straight up sun ray
line(100, 245, 100, 197)
//Draws line dividing the sky and ground
stroke(0, 0, 0);
line(0, 250, 500, 250);
//Draws ground
noStroke();
//Green colour
fill(29, 242, 82);
//Grass itself
quad(0, 250, 500, 250, 500, 500, 0, 500);
//Draws the house
strokeWeight(1);
//Salmon colour
fill(242, 102, 139);
//House rectangle
quad(300, 200, 450, 200, 450, 300, 300, 300);
//Draws roof
//Black
fill(0);
//Triangle iteself
triangle(275, 200, 375, 150, 475, 200);
//Draws Door
stroke(0);
// Sets colour to white
fill(255);
//Draws it
rect(350, 215, 50, 75);
//Draws the doorknob
//Black colour
fill(0);
//Actual shape
ellipse(360, 250, 5, 5);
}