-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathsketch.js
43 lines (38 loc) · 1.01 KB
/
sketch.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
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 6-2: Many lines with variables
function setup() {
createCanvas(480, 270);
background(255);
// Legs
stroke(0);
var y = 80; // Vertical location of each line
var x = 50; // Initial horizontal location for first line
var spacing = 10; // How far apart is each line
var len = 20; // Length of each line
// Draw the first leg.
line(x,y,x,y + len);
// Add spacing so the next leg appears 10 pixels to the right.
x = x + spacing;
// Continue this process for each leg, repeating it over and over.
line(x,y,x,y + len);
x = x + spacing;
line(x,y,x,y + len);
x = x + spacing;
line(x,y,x,y + len);
x = x + spacing;
line(x,y,x,y + len);
x = x + spacing;
line(x,y,x,y + len);
x = x + spacing;
line(x,y,x,y + len);
x = x + spacing;
line(x,y,x,y + len);
x = x + spacing;
line(x,y,x,y + len);
x = x + spacing;
line(x,y,x,y + len);
x = x + spacing;
line(x,y,x,y + len);
}