simvx.core.animation.tween

Tween system and easing functions for property animation.

Module Contents

Classes

TweenChain

Chainable tween builder for sequential animations.

Functions

ease_linear

Linear interpolation (no easing).

ease_in_quad

Quadratic ease-in.

ease_out_quad

Quadratic ease-out.

ease_in_out_quad

Quadratic ease-in-out.

ease_in_cubic

Cubic ease-in.

ease_out_cubic

Cubic ease-out.

ease_in_out_cubic

Cubic ease-in-out.

ease_in_quart

Quartic ease-in.

ease_out_quart

Quartic ease-out.

ease_in_out_quart

Quartic ease-in-out.

ease_in_quint

Quintic ease-in.

ease_out_quint

Quintic ease-out.

ease_in_out_quint

Quintic ease-in-out.

ease_in_sine

Sine ease-in.

ease_out_sine

Sine ease-out.

ease_in_out_sine

Sine ease-in-out.

ease_in_expo

Exponential ease-in.

ease_out_expo

Exponential ease-out.

ease_in_out_expo

Exponential ease-in-out.

ease_in_back

Back ease-in (overshoots).

ease_out_back

Back ease-out (overshoots).

ease_in_out_back

Back ease-in-out (overshoots).

ease_in_elastic

Elastic ease-in (spring effect).

ease_out_elastic

Elastic ease-out (spring effect).

ease_in_out_elastic

Elastic ease-in-out (spring effect).

ease_in_bounce

Bounce ease-in.

ease_out_bounce

Bounce ease-out.

ease_in_out_bounce

Bounce ease-in-out.

tween

Enhanced property tween generator with callbacks and repeating.

API

simvx.core.animation.tween.ease_linear(t: float) float[source]

Linear interpolation (no easing).

simvx.core.animation.tween.ease_in_quad(t: float) float[source]

Quadratic ease-in.

simvx.core.animation.tween.ease_out_quad(t: float) float[source]

Quadratic ease-out.

simvx.core.animation.tween.ease_in_out_quad(t: float) float[source]

Quadratic ease-in-out.

simvx.core.animation.tween.ease_in_cubic(t: float) float[source]

Cubic ease-in.

simvx.core.animation.tween.ease_out_cubic(t: float) float[source]

Cubic ease-out.

simvx.core.animation.tween.ease_in_out_cubic(t: float) float[source]

Cubic ease-in-out.

simvx.core.animation.tween.ease_in_quart(t: float) float[source]

Quartic ease-in.

simvx.core.animation.tween.ease_out_quart(t: float) float[source]

Quartic ease-out.

simvx.core.animation.tween.ease_in_out_quart(t: float) float[source]

Quartic ease-in-out.

simvx.core.animation.tween.ease_in_quint(t: float) float[source]

Quintic ease-in.

simvx.core.animation.tween.ease_out_quint(t: float) float[source]

Quintic ease-out.

simvx.core.animation.tween.ease_in_out_quint(t: float) float[source]

Quintic ease-in-out.

simvx.core.animation.tween.ease_in_sine(t: float) float[source]

Sine ease-in.

simvx.core.animation.tween.ease_out_sine(t: float) float[source]

Sine ease-out.

simvx.core.animation.tween.ease_in_out_sine(t: float) float[source]

Sine ease-in-out.

simvx.core.animation.tween.ease_in_expo(t: float) float[source]

Exponential ease-in.

simvx.core.animation.tween.ease_out_expo(t: float) float[source]

Exponential ease-out.

simvx.core.animation.tween.ease_in_out_expo(t: float) float[source]

Exponential ease-in-out.

simvx.core.animation.tween.ease_in_back(t: float) float[source]

Back ease-in (overshoots).

simvx.core.animation.tween.ease_out_back(t: float) float[source]

Back ease-out (overshoots).

simvx.core.animation.tween.ease_in_out_back(t: float) float[source]

Back ease-in-out (overshoots).

simvx.core.animation.tween.ease_in_elastic(t: float) float[source]

Elastic ease-in (spring effect).

simvx.core.animation.tween.ease_out_elastic(t: float) float[source]

Elastic ease-out (spring effect).

simvx.core.animation.tween.ease_in_out_elastic(t: float) float[source]

Elastic ease-in-out (spring effect).

simvx.core.animation.tween.ease_in_bounce(t: float) float[source]

Bounce ease-in.

simvx.core.animation.tween.ease_out_bounce(t: float) float[source]

Bounce ease-out.

simvx.core.animation.tween.ease_in_out_bounce(t: float) float[source]

Bounce ease-in-out.

class simvx.core.animation.tween.TweenChain(obj, prop: str, start_value=None)[source]

Chainable tween builder for sequential animations.

Example: TweenChain(obj, ‘position’, Vec3(0, 0, 0))
.to(Vec3(10, 0, 0), 1.0, ease_out_quad)
.wait(0.5)
.to(Vec3(0, 0, 0), 1.0, ease_in_quad)
.on_complete(lambda: print(“Done!”))
.build()

Initialization

to(target, duration: float, easing=ease_linear)[source]

Add a tween step.

wait(duration: float, fps: float = 60.0)[source]

Add a wait step.

on_complete(callback: collections.abc.Callable)[source]

Set completion callback.

build(fps: float = 60.0) simvx.core.descriptors.Coroutine[source]

Build the coroutine chain.

Args: fps: Frames per second for duration calculations.

simvx.core.animation.tween.tween(obj, prop: str, target, duration: float, easing=ease_linear, delay: float = 0, repeat: int = 1, on_step: collections.abc.Callable[[float], None] | None = None, on_repeat: collections.abc.Callable[[int], None] | None = None, on_complete: collections.abc.Callable | None = None, fps: float = 60.0) simvx.core.descriptors.Coroutine[source]

Enhanced property tween generator with callbacks and repeating.

Note: Uses frame-based timing (not real-time). Each yield represents one frame. Duration is converted to frame count based on fps parameter.

Args: obj: Object to animate. prop: Property name to animate. target: Target value. duration: Animation duration in seconds. easing: Easing function (default: linear). delay: Delay before starting animation in seconds. repeat: Number of times to repeat (1 = play once, 2 = repeat once, etc). on_step: Called each frame with current progress (0.0 to 1.0). on_repeat: Called when a repeat cycle completes, with repeat index. on_complete: Called when all repeats complete. fps: Frames per second for duration calculation (default: 60).

Example: yield from tween( player, ‘position’, Vec3(10, 0, 0), 2.0, easing=ease_out_quad, delay=0.5, repeat=2, on_complete=lambda: print(“Done!”) )