/
d06.gen-easeinout.py
61 lines (46 loc) · 1.23 KB
/
d06.gen-easeinout.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
import math
nbCoords = 128
origin = 0
coords1 = "d06.easeout: "
coords2 = "d06.easein: "
comma = ", "
speed = 0.70158;
duration = 1200.0 # in ms
begin = 0
change = 270
previousvalue = 0
for i in range(0, nbCoords):
time = duration / nbCoords * i
time = time / duration
#return c*(t/=d)*t*((s+1)*t - s) + b;
coord = int(change * (time * time * ((speed + 1.0) * time - speed)) + begin)
if i % 16 == 15:
comma = ""
else:
comma = ", "
if i % 16 == 0:
coords1 += "\n .dw "
coords1 += str(previousvalue - coord) + comma
previousvalue = coord
begin = 0
change = 255 - 80
previousvalue = 0
for i in range(0, nbCoords):
time = duration / nbCoords * i
time = time / duration - 1.0
#return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
coord = int(change * (time * time * ((speed + 1.0) * time + speed) + 1.0) + begin)
if i % 16 == 15:
comma = ""
else:
comma = ", "
if i % 16 == 0:
coords2 += "\n .dw "
coords2 += str(previousvalue - coord) + comma
previousvalue = coord
f = open('d06.easeinout.asm', 'w+')
f.write(coords1)
f.write('\n')
f.write(coords2)
f.write('\n')
f.close()