Variables
Variables are used for storing values. In this example, change the values of variables to affect the composition.
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
function setup() {
createCanvas(720, 400);
background(0);
stroke(153);
strokeWeight(4);
strokeCap(SQUARE);
let a = 50;
let b = 120;
let c = 180;
line(a, b, a + c, b);
line(a, b + 10, a + c, b + 10);
line(a, b + 20, a + c, b + 20);
line(a, b + 30, a + c, b + 30);
a = a + c;
b = height - b;
line(a, b, a + c, b);
line(a, b + 10, a + c, b + 10);
line(a, b + 20, a + c, b + 20);
line(a, b + 30, a + c, b + 30);
a = a + c;
b = height - b;
line(a, b, a + c, b);
line(a, b + 10, a + c, b + 10);
line(a, b + 20, a + c, b + 20);
line(a, b + 30, a + c, b + 30);
}