-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathliveSketch.js
More file actions
37 lines (34 loc) · 783 Bytes
/
liveSketch.js
File metadata and controls
37 lines (34 loc) · 783 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
36
37
/**
* Points and Lines.
*
* Points and lines can be used to draw basic geometry.
* Change the value of the variable 'd' to scale the form.
* The four variables set the positions based on the value of 'd'.
*/
function runLiveSketch(s) {
s.setup = () => {
var d = 70;
var p1 = d;
var p2 = p1 + d;
var p3 = p2 + d;
var p4 = p3 + d;
s.createCanvas(640, 360);
s.noSmooth();
s.background(0);
s.translate(140, 0);
// Draw gray box
s.stroke(153);
s.line(p3, p3, p2, p3);
s.line(p2, p3, p2, p2);
s.line(p2, p2, p3, p2);
s.line(p3, p2, p3, p3);
// Draw white points
s.stroke(255);
s.point(p1, p1);
s.point(p1, p3);
s.point(p2, p4);
s.point(p3, p1);
s.point(p4, p2);
s.point(p4, p4);
};
}