41 lines
No EOL
2.6 KiB
HTML
41 lines
No EOL
2.6 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Tween.ease — Ludic</title>
|
||
<meta name="description" content="Shape a 0..1 amount through an easing curve chosen by a literal mode.">
|
||
<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> <a href="ns-tween.html">Tween</a> <span>›</span> <span class="here">Tween.ease</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-method">method</span>
|
||
<h1 id="top">Tween.ease</h1>
|
||
</div>
|
||
<code class="sig">Tween.ease(t, mode) -> fixed</code>
|
||
<div class="desc"><p>Shapes a normalized amount <code>t</code> (<code>0.0</code>..<code>1.0</code>) through one of the engine's easing curves and returns the eased <code>fixed</code>. <code>mode</code> must be a literal integer selecting the curve — the same curves as the <a href="ease"><code>Ease</code></a> namespace:</p><p>- <code>0</code> — linear
|
||
- <code>1</code> — ease-in (quadratic)
|
||
- <code>2</code> — ease-out (quadratic)
|
||
- <code>3</code> — smooth ease-in-out
|
||
- <code>4</code> — ease-in-back (overshoots below 0)
|
||
- <code>5</code> — ease-out-elastic (springy settle)
|
||
- <code>6</code> — ease-out-bounce</p></div>
|
||
<div class="params"><h2>Parameters</h2><div class="param" id="param-t"><code class="pname">t</code><span class="pdesc">the amount to shape (a <code>fixed</code> in 0..1, e.g. from <a href="tween-progress"><code>Tween.progress</code></a>)</span></div><div class="param" id="param-mode"><code class="pname">mode</code><span class="pdesc">a literal <code>int</code> 0..6 selecting the curve</span></div></div>
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Demo {
|
||
handler Run phase Update {
|
||
let t = Tween.progress(fixed(1), fixed(2))
|
||
let e = Tween.ease(t, 4) # ease-in-back
|
||
let x = Tween.round(0, 200, e)
|
||
print(x)
|
||
}
|
||
}</pre></div>
|
||
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |