CLASS v1.8.0

Tween

pykraken.Tween

A class for animating values over time using easing functions.

More about Tween

This class supports pausing, resuming, reversing, and checking progress.

Reference

PYTHON API
Tween(ease_func: Callable[[float], float], duration: float)

Create a Tween.

Args

  • ease_func (Callable[[float], float]) — Easing function that maps [0, 1] → [0, 1].
  • duration (float) — Time in seconds for full animation.

current_pos

property
current_pos: Vec2

Get the current interpolated position snapshot.

Returns

  • Vec2 — Interpolated position.

end_pos

property
end_pos: Vec2

The ending position of the animation.

is_done

property
is_done: bool

Check whether the animation has finished.

start_pos

property
start_pos: Vec2

The starting position of the animation.

pause

method
pause(self) -> None

Pause the animation's progression.

restart

method
restart(self) -> None

Restart the animation from the beginning.

resume

method
resume(self) -> None

Resume the animation from its current state.

reverse

method
reverse(self) -> None

Reverse the direction of the animation.

Find your next step

Start typing to search the manual.