-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAula7_WavingArm2.py
59 lines (49 loc) · 953 Bytes
/
Aula7_WavingArm2.py
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
from p5 import *
arm_length = 100
angle = 0
angle_speed = 0.05
direction = 1
def setup():
size(800, 600)
def draw():
global angle, direction
background(240)
translate(0,100)
sphere(100)
translate(0,100)
sphere(75)
reset_matrix()
translate(50,-50,0)
sphere(25)
translate(0,50,0)
sphere(25)
reset_matrix()
translate(-50,-50,0)
sphere(25)
translate(0,50,0)
sphere(25)
reset_matrix()
translate(-70,150)
sphere(25)
translate(-50, 0)
sphere(25)
translate(0, -50)
sphere(25)
reset_matrix()
#braço
translate(70,150)
sphere(25)
translate(50, 0)
sphere(25)
angle += angle_speed * direction
if angle > PI / 8 or angle < -PI / 8:
direction *= -1
rotate_z(angle)
sphere(25)
translate(0, 50)
sphere(25)
translate(0, 50)
sphere(25)
translate(0, 50)
reset_matrix()
run(mode="P3D")