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:
parent
97178b84a3
commit
65aa99c883
11
ui.py
11
ui.py
|
|
@ -26,6 +26,17 @@ import data, stars
|
|||
|
||||
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:
|
||||
'''
|
||||
A canvas with scrolling support.
|
||||
|
|
|
|||
Loading…
Reference in New Issue