-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrotation.py
More file actions
44 lines (32 loc) · 882 Bytes
/
rotation.py
File metadata and controls
44 lines (32 loc) · 882 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
import os, time, math
import interfaceapi as iapi
tela = iapi.Tela(211, 2*57)
pontoA = iapi.Point(tela.getWidth()/2, tela.getHeight()/2)
pontoB = iapi.Point(tela.getWidth()/2, tela.getHeight()/2)
line = iapi.LineSegment(pontoA, pontoB)
hline = iapi.LineSegment(iapi.Point(50, 40), iapi.Point(70, 40))
for i in range(36):
tela.clear()
tela.drawBorder()
line.points[0].y -= 1
line.points[1].y += 1
hline.translateBy(0.0, 1.0)
tela.drawObject(line)
tela.drawObject(hline)
os.system('clear')
print(tela.toString())
time.sleep(0.1)
time.sleep(0.5)
tela.clear()
tela.drawBorder()
i = 0
while True:
tela.clear()
tela.drawBorder()
middle_point = line.middlePoint()
line.rotateAroundPoint(middle_point, math.pi/12)
tela.drawObject(line)
os.system('clear')
print(tela.toString())
time.sleep(1/18)
i += 1