Envelope Shaping
Sculpt bell curves and fades from linear data
The envelope shaping pattern turns a flat linear range into a smooth bell curve or fade. It’s the go-to technique whenever you need values that peak in the center and taper toward the edges — wave amplitudes in a Joy Division plot, stroke weights in a radial burst, or opacity falloff in a vignette.
Two approaches are common. The “Triangle-Power” chain uses abs, invert, and power to carve a peaked hump from a linear range — it’s easy to build from basic math nodes and gives direct control via the exponent. The Gaussian approach — e^(−k·x²) — produces a smoother, more natural bell and is the standard in signal processing, blur kernels, and audio envelopes.
Both start from a symmetric linspace (−1 to 1) and produce values that peak at the center. The interactive demo below lets you compare them side by side.
Two roads to the same bell — triangle-power for control, Gaussian for smoothness.
The Four Stages
- 01 Linspace
Generate a symmetric range from −1 to 1. Each value represents a position relative to the center — negative on the left, positive on the right.
- 02 Triangle-Power
Abs folds the range into a V, then 1−|x| flips it into a hump. Power controls the sharpness — low exponents flatten, high exponents sharpen.
- 03 Gaussian
Square the values, negate, scale by k, and exponentiate. The result is e^(−k·x²) — a smooth bell where k controls the width.
- 04 Output
Both approaches produce values from 0 to 1 that peak at center and fade to the edges. Use them to modulate amplitude, opacity, scale, or any other property.
const count = 50;
for (let i = 0; i < count; i++) {
const x = -1 + (2 * i) / (count - 1);
// Triangle-Power: abs → invert → power
const tri = Math.pow(1 - Math.abs(x), 2);
// Gaussian: e^(-k·x²)
const k = 2.5;
const gauss = Math.exp(-k * x * x);
}