gb-tarot/generate_animation_circling.py

24 lines
647 B
Python
Raw Permalink Normal View History

2025-01-09 15:39:07 -05:00
#!python3
from math import *
tile_size = 8
frames = []
2025-01-14 15:06:27 -05:00
center = (80, 40)
2025-01-09 15:39:07 -05:00
2025-01-14 15:06:27 -05:00
width_max = 24
width_min = 16
frame_count = 255
2025-01-09 15:39:07 -05:00
for t in range(frame_count):
2025-01-14 15:06:27 -05:00
e = ((width_min + width_max)*0.5) + (width_max - width_min)*0.5*sin(2*pi*t/frame_count)
half_width = e*0.5
x = center[0] - 60*cos(2*pi*t/frame_count) - half_width + 8 # plus 8 bc the overlap on the edges
y = center[1] - 2*half_width + 16 #plus 8 because of the underscan period
2025-01-09 15:39:07 -05:00
frames.append( (x, y, e) )
def h(flt):
return f'${int(floor(flt+0.5)):x}'
frame_strings = [f"{h(t[1])}, {h(t[0])}, {h(t[2])}" for t in frames]
print("db {}, {}".format(frame_count, ", ".join(frame_strings)))