docs: regenerate site from f094acfdb5
This commit is contained in:
commit
63c5ed9baf
975 changed files with 55427 additions and 0 deletions
36
math-inverse_lerp.html
Normal file
36
math-inverse_lerp.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Math.inverse_lerp — Ludic</title>
|
||||
<meta name="description" content="Find where a value sits between two endpoints as a 0..1 fraction.">
|
||||
<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-math.html">Math</a> <span>›</span> <span class="here">Math.inverse_lerp</span></div>
|
||||
<div class="item-head">
|
||||
<span class="kind-badge kind-method">method</span>
|
||||
<h1 id="top">Math.inverse_lerp</h1>
|
||||
</div>
|
||||
<code class="sig">Math.inverse_lerp(a, b, v) -> fixed</code>
|
||||
<div class="desc"><p>The inverse of <code>Math.lerp</code>: given endpoints <code>a</code> and <code>b</code> and a value <code>v</code>, it returns the fraction <code>(v - a) / (b - a)</code> — <code>0.0</code> when <code>v</code> equals <code>a</code>, <code>1.0</code> when it equals <code>b</code>. Use it to turn a raw quantity into a normalized amount: how full a health bar is, how far a timer has run, or the <code>t</code> to feed into another <code>Math.lerp</code>. The endpoints must differ, since equal ones would divide by zero.</p></div>
|
||||
<div class="params"><h2>Parameters</h2><div class="param" id="param-a"><code class="pname">a</code><span class="pdesc">the endpoint that maps to <code>0.0</code></span></div><div class="param" id="param-b"><code class="pname">b</code><span class="pdesc">the endpoint that maps to <code>1.0</code></span></div><div class="param" id="param-v"><code class="pname">v</code><span class="pdesc">the value to locate between them</span></div></div>
|
||||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program HealthFraction {
|
||||
const MAX_HP: fixed = 200.0
|
||||
|
||||
var hp: fixed = 150.0
|
||||
|
||||
handler Draw phase Render {
|
||||
let fraction = Math.inverse_lerp(0.0, MAX_HP, hp) # 0.75
|
||||
}
|
||||
}</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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue