-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrotlogo.py
137 lines (80 loc) · 2.32 KB
/
rotlogo.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
"""
Logo Animation
by Sam Neurohack
from /team/laser
"""
from globalVars import *
import frame
import sys, math, random
import vectors
import gstt
class Logo(object):
def __init__(self):
self.width = screen_size[0]
self.height = screen_size[1]
self.centerX = self.width / 2
self.centerY = self.height / 2
self.fov = 256
self.viewer_distance = 300.2
self.angleX = 0
self.angleY = 180
self.angleZ = 180
self.color = 0x000000
self.LOGO = [
# Etoile
[[(-155,-95),(-135,-85)],0xFF00],
[[(-155,-85),(-135,-95)],0xFF00],
[[(-150,-100),(-140,-80)],0xFF00],
# L/o
[[(-140,-100),(-200,20),(120,20)],0xFF00],
# aser
[[(-140,-40),(-100,-40,),(-120,0),(-160,0),(-110,-20)],0xFFFF],
[[(-40,-40),(-60,-40),(-90,-20),(-50,-20),(-80,0),(-100,0)],0xFFFF],
[[(-30,-20),(10,-20),(0,-40),(-20,-40),(-30,-20),(-30,0),(-10,0)],0xFFFF],
[[(20,0),(40,-40),(35,-30),(50,-40),(70,-40)],0xFFFF],
]
self.LOGO_OFFSET = vectors.Vector2D(400,320)
def Move(self,centerX,centerY):
self.centerX = centerX
self.centerY = centerY
def Zoom(self, zoom):
self.viewer_distance = zoom
def Draw(self,f):
'''
Draw with Y rotation animation
'''
#self.angleX += 0.05
self.angleY += 0.5
#self.angleZ += 0.1
for pl_color in self.LOGO:
c = pl_color[1]
xy_list = []
for xy in pl_color[0]:
x = xy[0]
y = xy[1]
z=0
# 3D rotation along self.angleX, self.angleX, self.angleX
rad = self.angleX * math.pi / 180
cosa = math.cos(rad)
sina = math.sin(rad)
y2 = y
y = y2 * cosa - z * sina
z = y2 * sina + z * cosa
rad = self.angleY * math.pi / 180
cosa = math.cos(rad)
sina = math.sin(rad)
z2 = z
z = z2 * cosa - x * sina
x = z2 * sina + x * cosa
rad = self.angleZ * math.pi / 180
cosa = math.cos(rad)
sina = math.sin(rad)
x2 = x
x = x2 * cosa - y * sina
y = x2 * sina + y * cosa
# 3D to 2D projection
factor = self.fov / (self.viewer_distance + z)
x = x * factor
y = - y * factor
xy_list.append((self.LOGO_OFFSET + vectors.Vector2D(x,y)).ToTuple())
f.PolyLineOneColor(xy_list, c)