Reference · Deterministic 2D physics
clampfunction
value held between low and high.
Import it
import { clamp } from "@johnmorrisdotca/karakuri/physics";
Definition
function clamp(value: number, low: number, high: number): number
Parameters
| Name | Type | Description |
|---|---|---|
value | number | The number to clamp. |
low | number | The lower clamp bound. |
high | number | The upper clamp bound. |
Returns
number
value held between low and high.
Examples
import { clamp } from "@johnmorrisdotca/karakuri/physics";
console.log(clamp(20,0,10));10What it prints (run when this page was built)