Precomputed easing values.

When panning the star map it would be well to have a smooth animation
for the movement.

THese values are from easeInOutQuad at:

=> https://gist.github.com/gre/1650294
This commit is contained in:
Simon Forman 2024-04-16 09:35:55 -07:00
parent 97178b84a3
commit 65aa99c883
1 changed files with 11 additions and 0 deletions

11
ui.py
View File

@ -26,6 +26,17 @@ import data, stars
DARK_GRAY = '#222' DARK_GRAY = '#222'
ease = 0.0, 0.02, 0.08, 0.18, 0.32, 0.5, 0.68, 0.82, 0.92, 0.98, 1.0
def eased(from_, to):
interval = to - from_
for e in ease:
yield round(from_ + interval * e)
def eased_xy(from_x, from_y, to_x, to_y):
yield from zip(eased(from_x, to_x), eased(from_y, to_y))
class App: class App:
''' '''
A canvas with scrolling support. A canvas with scrolling support.