Files
prosperon/docs/api/modules/tween.md
John Alanbrook 83b798e365 Add Hugo website and rewrite docs to match current engine
New Hugo site in website/ with prosperon.dev theme (blue/gold/castle
aesthetic), docs sidebar navigation, and content pages. Rewrote all
doc files to align with the actual codebase: compositor+film2d
rendering, use() modules (no global prosperon object), Pit language,
script+JSON entity model. Added entities.md, front matter to all
70+ API docs, and updated API index for current module architecture.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:09:55 -06:00

1.7 KiB

title, type
title type
tween docs

tween

Tween object

An object providing methods to create and control tweens with additional features like looping, custom easing, multiple stages, etc.

Properties:

  • default: A template object with loop/time/ease/whole/cb properties. Methods:
  • start(obj, target, tvals, options): Create a tween over multiple target values.
  • make: Alias of start.

Ease object

This object provides multiple easing functions that remap a 0..1 input to produce a smoothed or non-linear output. They can be used standalone or inside tweens.

Available functions:

  • linear(t)
  • in(t), out(t), inout(t)
  • quad.in, quad.out, quad.inout
  • cubic.in, cubic.out, cubic.inout
  • quart.in, quart.out, quart.inout
  • quint.in, quint.out, quint.inout
  • expo.in, expo.out, expo.inout
  • bounce.in, bounce.out, bounce.inout
  • sine.in, sine.out, sine.inout
  • elastic.in, elastic.out, elastic.inout

All easing functions expect t in [0..1] and return a remapped value in [0..1].

tween(from, to, time, fn, cb) function

Creates a simple tween that linearly interpolates from "from" to "to" over "time" and calls "fn" with each interpolated value. Once finished, "fn" is called with "to", then "cb" is invoked if provided, and the tween is cleaned up.

from: The starting object or value to interpolate from.

to: The ending object or value to interpolate to.

time: The total duration of the tween in milliseconds or some time unit.

fn: A callback function that receives the interpolated value at each update.

cb: (Optional) A callback invoked once the tween completes.

Returns: A function that, when called, cleans up and stops the tween.