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.
At a glance
9 membersReference
PYTHON APIConstructor
methodTween(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
propertycurrent_pos: Vec2Get the current interpolated position snapshot.
Returns
- Vec2 — Interpolated position.
end_pos
propertyend_pos: Vec2The ending position of the animation.
is_done
propertyis_done: boolCheck whether the animation has finished.
start_pos
propertystart_pos: Vec2The starting position of the animation.
pause
methodpause(self) -> NonePause the animation's progression.
restart
methodrestart(self) -> NoneRestart the animation from the beginning.
resume
methodresume(self) -> NoneResume the animation from its current state.
reverse
methodreverse(self) -> NoneReverse the direction of the animation.