tween — Luau Binding

require("tween"): animate a target's properties from → to over a duration with easing, on the stage tick. The programmatic surface of the tween system, and the engine behind AntBASIC's TWEEN. Every function is [antos].

Status: design. Not built yet. Signatures are the intended surface, settled against the tween model.

local tween = require("tween")

Animate

Call Returns Does
tween.to(target, props, opts?) handle, err animate props (a { name = value } table) to those values from the target's current ones, in the background. opts = { duration, easing = "linear", loop = false, yoyo = false, delay = 0 }. Replaces any tween on a property it touches; different properties run together
tween.from(target, props, opts?) handle, err animate from props to the target's current values — an entrance
tween.stop(target, prop?) ok cancel tweens on target — a single prop, or all of them
tween.running(target, prop?) bool whether a tween is active on the target (or a given property)
local tween  = require("tween")
local motion = require("motion")
local s = motion.target("sprite", 3)

tween.to(s, { alpha = 0, scale = 2 }, { duration = 1.5, easing = "ease-out" })   -- fade + grow together
tween.to(s, { color = 0xFF0000 },     { duration = 1, loop = true, yoyo = true }) -- pulse red, forever

Values

Call Returns Does
tween.value(from, to, t, easing?) number the pure interpolation from + (to − from) × eased(t) for t ∈ [0,1] — the primitive the engine uses, exposed for a caller that wants a value without a running tween

Where to go next

  • The tween model, properties, and lifetime → tween
  • The substrate — tick, targets, phase order → stage
  • The position sibling → motion · its binding → luau_motion

Important: The Ant64 family of home computers are at early design/prototype stage, everything you see here is subject to change.