Animation finishes faster than expected
encukou opened this issue · comments
Petr Viktorin commented
This demo should result in a smoothly moving circle:
from wasabi2d import animate, clock, Scene, run
scene = Scene()
circle = scene.layers[0].add_circle(
radius=30,
pos=(30, 300),
color='red',
)
async def move():
while True:
current_x, current_y = circle.pos
await animate(
circle,
tween='linear',
pos=(current_x + 50, current_y),
)
clock.coro.run(move())
run()
Instead, the movement is jerky.
This is because the mutable NumPy array used in the primitive's pos
is also used as the animation's initial
value.
Daniel Pope commented
Oh, wow! That's the cause of #36!
Great spot!
Daniel Pope commented
(I strongly prefer non-mutable vector classes; our hunt for a fast and non-mutable vector class to use for Transformable.pos is #17)
Daniel Pope commented
I think just adding a tuple(initial)
would be the most general fix, in any case.