Tweens¶
Pite includes runtime-managed property and callback tweens for smooth animations, UI transitions, and timed sequences without manual timer boilerplate.
t = pite.tween()
t.property(self, "position", (200.0, 100.0), 0.5).ease("out").trans("cubic")
t.parallel().property(self, "modulate", "#ffffff80", 0.5)
t.callback(lambda: print("done!"))
Creating & Sequencing Tweens¶
pite.tween() -> Tween: Creates a new runtime-managed sequential tween. Steps added to aTweenexecute one after another by default..parallel(): Makes the next step run concurrently with the previous step instead of waiting for it to finish..property(target, prop: str, final_val, duration: float) -> PropertyTweener: Interpolatespropontargetoverdurationseconds. Supports:float/intVec2or(x, y)tuples (e.g.,"position","scale")Color,(r, g, b, a)tuples, or#rrggbbaahex strings (e.g.,"modulate")
.callback(fn, delay: float = 0.0): Invokesfnafter an optionaldelay..interval(duration: float): Waits fordurationseconds before advancing to the next step..loops(count: int): Repeats the tweencounttimes (0= infinite)..on_finished(fn): Registers a callback invoked when the entire tween finishes.
Easing & Transitions¶
property(...) returns a PropertyTweener with chainable configuration methods:
.ease(mode: str):"in","out","in_out", or"out_in"..trans(curve: str):"linear","quad","cubic","sine","back","bounce", or"elastic"..from_(val): Overrides the starting value instead of reading the node's current property value when the step begins..delay(seconds: float): Delays the start of this property interpolation.
Playback Control & Lifecycle¶
.pause()/.play(): Pauses or resumes the tween..stop(): Stops the tween and resets it..kill(): Immediately cancels and removes the tween..is_running() -> bool: ReturnsTruewhile the tween is active.
Missing target nodes are skipped cleanly, finished tweens are removed automatically, and all active tweens are cleared when the scene is reloaded or stopped.