Math. No import, call them like Math.sin.
Overview
Interpolation
clamp, lerp, inverseLerp, smoothStep, remap.Angle units
toRadians, toDegrees.TypeError, there’s no coercion.
Interpolation
clamp
value between min and max. Swapped bounds work too.
lerp
a at t = 0, b at t = 1. t isn’t clamped, so values outside 0–1 overshoot.
inverseLerp
value sits between a and b, as 0–1. Not clamped. Returns 0 when a === b.
smoothStep
lerp, but eased in and out. t is clamped to 0–1.
remap
value from one range to another. Not clamped, and inMin === inMax gives outMin.
- Health → color
- Distance → alpha
Angle units
Game angles (QAngle) are in degrees.Math.sin and friends want radians.