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

22 lines
No EOL
2.5 KiB
HTML
Raw Permalink 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>Percent — Ludic</title>
<meta name="description" content="A value clamped to [0, 1] — health fractions, volumes, and the t of an interpolation, without stray values slipping below 0 or above 1.">
<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">Percent</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Percent</h1></div>
<p class="ns-blurb">A value clamped to <code>[0, 1]</code> — health fractions, volumes, and the <code>t</code> of an interpolation, without stray values slipping below 0 or above 1. <code>Percent.clamp</code> pins any <code>fixed</code> into range; <code>Percent.of</code> forms a clamped ratio <code>num / den</code>; <code>Percent.lerp</code> interpolates <code>a..b</code> by a clamped <code>t</code>; and <code>Percent.apply</code> scales a value by a clamped fraction. Every operation is deterministic fixed-point. Arguments are positional. Spliced in only when a program mentions <code>Percent.*</code>.</p>
<div class="ns-methods"><a class="ns-method" href="percent-clamp.html"><code class="nm-sig">Percent.clamp(v) -&gt; fixed</code><span class="nm-tip">Clamp any fixed into [0, 1].</span></a><a class="ns-method" href="percent-of.html"><code class="nm-sig">Percent.of(num, den) -&gt; fixed</code><span class="nm-tip">Clamped ratio num / den.</span></a><a class="ns-method" href="percent-lerp.html"><code class="nm-sig">Percent.lerp(a, b, t) -&gt; fixed</code><span class="nm-tip">Interpolate a..b by a clamped t.</span></a><a class="ns-method" href="percent-apply.html"><code class="nm-sig">Percent.apply(value, p) -&gt; fixed</code><span class="nm-tip">Scale a value by a clamped percent.</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>