Bezier / Catmull-Rom Splines
First appeared 1962 · Pierre Bézier, Paul de Casteljau — Bézier curves — Pierre Bézier (1962); de Casteljau (1959). · timeline ↗
community / folk Name — Descriptive: "spline" is borrowed from draughtsmen's flexible splines; the eponymous families are Bézier and de Casteljau (1962) / B-splines. The general term is descriptive.
In one line Classic methods for building smooth curves from a few control points — Bézier (control points pull the curve) and Catmull-Rom (the curve passes through the points). Used for ribbons, plant stems and flowing abstract line work.
The code
The actual sketch behind the demo above — sandboxed and reproducible. This is the whole thing.
spline-curves/index.html
const SEED = Math.floor(Math.random()*1e9);
function setup() {
randomSeed(SEED); noiseSeed(SEED);
const s = Math.min(windowWidth, windowHeight);
createCanvas(s, s);
background('#f5f1e8');
noFill();
strokeWeight(s * 0.0035);
strokeJoin(ROUND);
// Catmull-Rom splines over noise-perturbed control points.
// p5's curveVertex() implements Catmull-Rom; we feed N noisy nodes
// for each ribbon.
const RIBBONS = 14;
const NODES = 12;
const palette = ['#1a1a2e', '#16213e', '#c63d2f', '#e1a624', '#3b7a57'];
for (let r = 0; r < RIBBONS; r++) {
stroke(palette[r % palette.length]);
const baseY = lerp(s * 0.18, s * 0.82, r / (RIBBONS - 1));
const amp = s * 0.06 + noise(r * 0.7) * s * 0.08;
const phase = noise(r * 0.9 + 17) * TWO_PI;
beginShape();
// duplicate first vertex so the curve starts at the first node
curveVertex(-s * 0.1, baseY);
for (let i = 0; i < NODES; i++) {
const t = i / (NODES - 1);
const x = lerp(-s * 0.05, s * 1.05, t);
const y =
baseY +
Math.sin(t * TWO_PI * 1.5 + phase) * amp +
(noise(r * 1.3, i * 0.5) - 0.5) * amp * 1.5;
curveVertex(x, y);
}
curveVertex(s * 1.1, baseY);
endShape();
}
}How it works
A cubic Bézier is defined by 4 control points; evaluate it at parameter t∈[0,1] by the de Casteljau algorithm — repeatedly linearly interpolate between adjacent points (lerp the 4 to 3, the 3 to 2, the 2 to 1); the final point is the curve at t. Sweeping t from 0→1 traces the curve, which stays inside the control polygon's convex hull but generally does not pass through the interior points. A Catmull-Rom spline instead interpolates — it passes through every point, and each segment's tangent is derived from the neighbouring points — so it is ideal for drawing a smooth curve through a sequence of sampled positions. Chaining segments with shared endpoints (and matched tangents for C¹ continuity) builds longer paths.
Parameters
type: string — Curve family — Bézier (shaped by control points) or Catmull-Rom (interpolating the points).tension: number — Catmull-Rom tension; how tightly the curve hugs its points.resolution: number — Samples drawn per segment; higher is smoother.controlPoints: array — The points the curve interpolates or is shaped by.
Lineage
Frequently combined with
- Perlin / Simplex Noise · 27 works
- HSL / Hue Cycle · 20 works
- Fragment Shader (GLSL) · 15 works
- Particle System · 11 works
- Flow Field / Vector Field · 9 works
- Marching Squares / Contours · 7 works
- Plotter-style Hatching · 7 works
- Audio-Reactive · 5 works
- Delaunay Triangulation · 4 works
- Voronoi Diagram · 4 works
- Raymarching with SDFs · 4 works
- Fractal / Recursive Subdivision · 3 works
Works using this algorithm (102)
Last updated 2026-07-16