API Reference › Tween › Tween.to
method

Tween.to

Tween.to(from, to, dur, ease) -> handle

Starts a stateful tween handle — from from to to over dur ticks with easing ease — and returns an integer handle. Unlike the pure Tween.progress interpolators (which the game drives from its own timer), a handle is advanced by the engine one tick per frame: fire it once, then read Tween.value each frame and Tween.done to know when it finishes. Tween.chain and Tween.delay append segments for a sequence. Integer and deterministic, so a sequence plays identically under replay. The handle pool is fixed-size and reuses finished slots.

Parameters

durthe segment length in engine ticks
ease0 linear, 1 in, 2 out, 3 in-out

Example

program Demo {
  property SpriteAnim { ticks: int = 0, fps: int = 0, frames: int = 0, mode: int = 0, frame: int = 0 }
  property Pop { h: int = 0 }
  model Coin { SpriteAnim, Pop }
  entry {
    spawn Coin { Pop { h: 0 } }
    let e = World.query_next(World.prop_id("Pop"), 0)
    let f = World.field_id(World.prop_id("Pop"), "h")
    World.set(e, World.prop_id("Pop"), f, Tween.to(0, 40, 20, 2))   # pop upward
    quit()
  }
}
← All symbols