ludic/ns-tween.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
5.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tween — Ludic</title>
<meta name="description" content="Value interpolation over a timeline, off the fixed frame clock.">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">Tween</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Tween</h1></div>
<p class="ns-blurb">Value interpolation over a timeline, off the fixed frame clock. The timeline helpers <a href="tween-progress"><code>Tween.progress</code></a>/<a href="tween-loop"><code>Tween.loop</code></a>/<a href="tween-yoyo"><code>Tween.yoyo</code></a> turn an elapsed <code>timer</code> and a <code>duration</code> into a normalized amount; <a href="tween-ease"><code>Tween.ease</code></a> shapes that amount through an easing curve (shared with <a href="ease"><code>Ease</code></a>); and the typed blends <a href="tween-number"><code>Tween.number</code></a>/<a href="tween-round"><code>Tween.round</code></a>/<a href="tween-point"><code>Tween.point</code></a>/<a href="tween-tint"><code>Tween.tint</code></a> interpolate a <code>fixed</code>, <code>int</code>, <code>Vector</code>, or color. All deterministic fixed-point, so a replay reproduces every eased value exactly. Beyond these pure interpolators there are <strong>fluent handles</strong> the engine advances for you: <a href="tween-to"><code>Tween.to</code></a> starts one and returns a handle, <a href="tween-chain"><code>Tween.chain</code></a> and <a href="tween-delay"><code>Tween.delay</code></a> sequence more segments, and <a href="tween-value"><code>Tween.value</code></a> / <a href="tween-done"><code>Tween.done</code></a> / <a href="tween-parallel"><code>Tween.parallel</code></a> / <a href="tween-stop"><code>Tween.stop</code></a> read and control them.</p>
<div class="ns-methods"><a class="ns-method" href="tween-progress.html"><code class="nm-sig">Tween.progress(timer, duration) -&gt; fixed</code><span class="nm-tip">A one-shot 0..1 amount, clamped, for timer over duration.</span></a><a class="ns-method" href="tween-loop.html"><code class="nm-sig">Tween.loop(timer, duration) -&gt; fixed</code><span class="nm-tip">A repeating 0..1 sawtooth amount over duration.</span></a><a class="ns-method" href="tween-yoyo.html"><code class="nm-sig">Tween.yoyo(timer, duration) -&gt; fixed</code><span class="nm-tip">A repeating 0..1..0 triangle amount over duration.</span></a><a class="ns-method" href="tween-done.html"><code class="nm-sig">Tween.done(timer, duration) -&gt; bool</code><span class="nm-tip">True once a one-shot tween's timer reaches its duration.</span></a><a class="ns-method" href="tween-ease.html"><code class="nm-sig">Tween.ease(t, mode) -&gt; fixed</code><span class="nm-tip">Shape a 0..1 amount through an easing curve chosen by a literal mode.</span></a><a class="ns-method" href="tween-number.html"><code class="nm-sig">Tween.number(from, to, t) -&gt; fixed</code><span class="nm-tip">Linear blend of two fixeds by amount t.</span></a><a class="ns-method" href="tween-round.html"><code class="nm-sig">Tween.round(from, to, t) -&gt; int</code><span class="nm-tip">Linear blend of two ints by amount t, rounded to the nearest int.</span></a><a class="ns-method" href="tween-point.html"><code class="nm-sig">Tween.point(from, to, t) -&gt; Vector</code><span class="nm-tip">Component-wise blend of two Vectors by amount t.</span></a><a class="ns-method" href="tween-tint.html"><code class="nm-sig">Tween.tint(from, to, t) -&gt; int</code><span class="nm-tip">Per-channel blend of two colors by amount t.</span></a><a class="ns-method" href="tween-to.html"><code class="nm-sig">Tween.to(from, to, dur, ease) -&gt; handle</code><span class="nm-tip">Start a fluent, engine-advanced tween and return a handle.</span></a><a class="ns-method" href="tween-chain.html"><code class="nm-sig">Tween.chain(handle, to, dur, ease) -&gt; handle</code><span class="nm-tip">Append a tween segment that runs after the handle's current queue.</span></a><a class="ns-method" href="tween-delay.html"><code class="nm-sig">Tween.delay(handle, ticks) -&gt; handle</code><span class="nm-tip">Append a pause to a tween handle's sequence.</span></a><a class="ns-method" href="tween-value.html"><code class="nm-sig">Tween.value(handle) -&gt; int</code><span class="nm-tip">The current value of a fluent tween handle this frame.</span></a><a class="ns-method" href="tween-stop.html"><code class="nm-sig">Tween.stop(handle)</code><span class="nm-tip">Stop and dispose a tween handle, freezing its value.</span></a><a class="ns-method" href="tween-parallel.html"><code class="nm-sig">Tween.parallel(a, b) -&gt; bool</code><span class="nm-tip">Are two tween handles both finished? — a parallel completion query.</span></a></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>