The ergonomic layer over the engine-owned SpriteAnim/Motion systems (#43): - Named clips: Anim.clip("run", frames, fps, mode) registers a clip by name and Anim.play(entity, "run") plays it; Anim.play(entity, fps, frames, mode) sets the clip directly. A name-keyed registry in systems.ludic. - Frame events: Anim.on_frame(entity, frame) arms optional SpriteAnim event_frame/event_fired fields; the engine flags the tick the clip first lands on that frame, and Anim.fired(entity) reads it — the game reacts, so it stays inside the no-runtime-dispatch event model. - Motion.to(entity, from, to, dur, ease) starts a value tween over the Motion component in one call (reflection-ABI writes, resetting the timer). - Fluent Tween handles (runtime/native/tween.ludic): Tween.to / Tween.chain / Tween.delay build a sequenced, disposable handle advanced by a new engine-owned system (esys_tween, run each Update tick); Tween.value / Tween.done / Tween.parallel / Tween.stop read and control it. The 1-arg Tween.done(handle) is disambiguated from the 2-arg pure Tween.done(timer, dur). Splicing: g_uses_anim_rt pulls in systems.ludic; g_uses_tween_rt pulls in tween.ludic and inserts esys_tween into the Update phase. All integer and deterministic, so animation and motion reproduce exactly under replay/lockstep. Worked example + regression: examples/library/anim_sugar.ludic (4 8 2 1 0 100 100 0 0 1 20 20 30 0 1). Twelve new docs pages (Anim, the new Motion namespace, Tween handles). Full suite 77 passed, self-host C-free fixpoint intact, no golden drift. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 KiB
1 KiB
| id | name | category | kind | tokens | sig | tip | order | ns | member |
|---|---|---|---|---|---|---|---|---|---|
| tween-value | Tween.value | tween | namespace-method | Tween.value | Tween.value(handle) -> int | The current value of a fluent tween handle this frame. | 33 | Tween | value |
Returns the current interpolated value of a tween handle this frame — the number the engine advanced it to. Read it each frame to drive a position, an alpha, a scale. Once every segment has finished the value rests on the final target; Tween.done reports when that has happened. Returns 0 for an invalid handle.
Parameters:
handle— the tween handle to read
program Demo {
property Pos { x: int = 0 }
property Tw { h: int = 0 }
model Mover { Pos, Tw }
handler Move phase Update {
let p = World.prop_id("Pos")
let t = World.prop_id("Tw")
let e = World.query_next(t, 0)
let h = World.get(e, t, World.field_id(t, "h"))
World.set(e, p, World.field_id(p, "x"), Tween.value(h))
}
}