ApasScript.

Noise And Easing

lerp

lerp(a, b, t): the value t of the way from a (t = 0) to b (t = 1), a + (b - a)t. Exact for exact inputs; t outside 0..1 extrapolates. (With five arguments, lerp is the numerical-methods interpolation.)

inverseLerp

The t with lerp(a, b, t) = v: (v - a)/(b - a).

remap

v moved from the range a1..b1 to the range a2..b2 (linearly, not clamped).

clamp

v limited to the range lo..hi.

smoothstep

0 below e0, 1 above e1, and the smooth S-curve t^2(3 - 2t) between (t = (x - e0)/(e1 - e0)), as in GLSL.

smootherstep

Like smoothstep() but with 6t^5 - 15t^4 + 10t^3, flat to the second derivative at both ends (Perlin's fade curve).

ease

An easing curve at t (0 at t = 0, 1 at t = 1): "cubicInOut" (default), "linear", "quadIn", "quadOut", "quadInOut", "cubicIn", "cubicOut", "sineIn", "sineOut", "sineInOut" (Penner's easing equations). Exact where the answer is.

tween

From a to b along an easing curve: lerp(a, b, ease(t, curve)).

noise

Perlin noise: a smooth random-looking value in about -1..1 at x, (x, y) or (x, y, z); 0 at whole numbers. Ken Perlin's improved noise; seed(n) picks a different field (the same n, the same field).

fbm

Fractal noise: 'octaves' layers of noise(), each twice the frequency and half the strength of the last (fractal Brownian motion), about -1..1. Octaves 1 to 16.