-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshapes.html
More file actions
70 lines (40 loc) · 1.18 KB
/
shapes.html
File metadata and controls
70 lines (40 loc) · 1.18 KB
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
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.16/p5.js"></script>
<script>
function setup() {
createCanvas(windowWidth,windowHeight);
background('#EBF5FB');
}
function draw() {
fill('red');
//Rectangle and Square:
//rect(x,y,width,height)
//rect function makes a square with same width and height
rect(20,180,60,60);
//rect function makes a rectangle with different width and height
rect(20,100,150,60);
//Circle and Oval:
//ellipse(x,y,width,height)
//ellipse function makes a circle when width and height are same e.g w=30 and h=30
fill('yellow');
ellipse(90, 280, 60, 60);
//ellipse function makes an oval when width and height are different.
ellipse(180,280,70,50);
ellipse(270,270,50,70);
//Triangle :
//triangle(x1,y1,x2,y2,x3,y3)
fill('green');
triangle(150, 50, 300, 200, 450, 50);
triangle(300,300,450,150,600,300);
//line
//line(x1,y1,x2,y2)
stroke('purple');
line(450,320,800,320);
line(700,250,700,550);
}
</script>
</head>
<body>
</body>
</html>