-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathperson.js
More file actions
51 lines (45 loc) · 819 Bytes
/
person.js
File metadata and controls
51 lines (45 loc) · 819 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function person(walking) {
noStroke();
ambientMaterial(250);
//specularMaterial(250);
// Head
push();
translate(0, -200, 0);
scale(0.5);
sphere(50, 10, 10);
pop();
push();
translate(0, -120, 0);
scale(0.5, 1, 0.5);
sphere(50, 10, 10);
pop();
[-1, 1].forEach(side => {
ambientMaterial(250);
stroke(200, 50, 50);
noFill();
// arm
line(
side*20, -150, 0,
side*50, -50,
walking ?
sin(side + frameCount/10)*50 :
0
);
// leg
line(
side*10, -80, 0,
side*20, 0,
walking ?
sin(side + frameCount/10)*50 :
0
);
// eyes
noStroke();
fill(255);
emissiveMaterial(255);
push();
translate(side*15, -200, 20);
sphere(10, 5, 5);
pop();
});
}