Untitled (After John Provencher)

Type
Creative Coding
Year
2026
Tools
  • p5.js

This sketch starts from John Provencher’s Chromebook animation for The New York Times: a thin slab turning in space, its surface a mosaic of colored pixels that reads as a screen when it faces you and nearly disappears when it turns edge-on. I wanted to see whether that pixel surface could carry a gesture instead of a device.

Reference: John Provencher, Chromebook animation for The New York Times.

In p5.js, I traced a hand-drawn flourish into a cloud of points, gave every point that flickering pixel texture, and turned the whole shape through one revolution before letting it dissolve. The loop is built in four parts.

How the sketch works

Trace the drawing into points

The flourish starts as a drawing, swirl.png. I sample it on a grid about 220 cells across and keep every cell bright or opaque enough to count as ink. Each kept cell becomes a point, centered and scaled to fill 64% of the canvas. More than half the cells get a jittered twin, and some a looser third point, so the edge breaks up like hand-placed tiles instead of a clean raster.

sampleStep = max(2, floor(max(swirlImg.width, swirlImg.height) / 220));
// …
for (let y = minY; y <= maxY; y += sampleStep) {
  for (let x = minX; x <= maxX; x += sampleStep) {
    if (cellOccupied(x, y, sampleStep)) {
      const px = (x - cx) * fit;
      const py = (y - cy) * fit;

      pts.push({ x: px, y: py });

      if (hash(x * 0.13 + y * 0.19) < 0.58) {
        pts.push({
          x: px + (hash(x * 0.41 + y * 0.29) - 0.5) * baseBlock * 0.48,
          y: py + (hash(x * 0.27 + y * 0.37) - 0.5) * baseBlock * 0.48
        });
      }
      // …

Give each point a screen-like texture

Every point is drawn as up to three stacked, offset squares. The canvas is divided into 34-pixel regions, and each region picks three colors from a nine-color palette and one of six patterns: stripes, sloped bands, noise, 2 × 2 checks, waves or a modular repeat. The choice changes every 12 frames, so the surface flickers like a screen refreshing. All randomness comes from a sine-based hash() instead of random(), so every frame is reproducible and the loop repeats exactly.

const PATTERN_HOLD = 12;
// …
const patternIndex = floor(loopFrame / PATTERN_HOLD);
// …
const macroSeed = floor(
  hash(rgx * 17.31 + rgy * 61.17 + patternIndex * 5.11) * textureCombos.length
);

const combo = textureCombos[macroSeed];
// …
const patternType = floor(hash(rgx * 11.9 + rgy * 7.3 + patternIndex * 3.1) * 6);
// …
function hash(n) {
  return fract(sin(n * 12.9898) * 43758.5453123);
}

Turn it in space

Each point is tilted around the x-axis, spun around the y-axis and projected with a simple perspective divide. The shape starts tilted about 85° away from the viewer, almost edge-on like Provencher’s slab, then rises to face the screen on an ease-out curve while making one full turn.

spinY = map(loopFrame, 0, ROTATE_FRAMES, 0, TWO_PI * ROTATION_TURNS);

const riseT = constrain(loopFrame / RISE_FRAMES, 0, 1);
tiltX = lerp(HALF_PI * 0.94, 0, easeOutCubic(riseT));
// …
let v = rotatePoint3D(p.x, p.y, 0, tiltX, spinY);

const persp = focalLength / (focalLength + v.z);

let sx = v.x * persp;
let sy = v.y * persp;

Hold, then dissolve

Once the shape faces the viewer, the palette narrows to five colors and the blocks swell slightly. Then each block’s chance of being drawn falls from 1 to 0.02 on an ease-in curve while it drifts outward, rises, shrinks and fades, so the flourish breaks into specks before the loop restarts edge-on.

const e = easeInQuad(t);

const keepProb = lerp(1.0, 0.02, e);

if (hash(i * 9.11 + patternIndex * 5.33 + 77.0) > keepProb) {
  visible = false;
}

const ang = TWO_PI * hash(i * 2.73 + 99.0);
const drift = (8 + 70 * hash(i * 7.19 + 31.0)) * e;

sx += cos(ang) * drift;
sy += sin(ang) * drift - 24 * e;

block *= lerp(1.05, 0.48, e);
alpha = lerp(238, 8, e);
The sketch running live in your browser.