Loading video...

Video Failed to Load

Go Home

Three.js doesn't own the layout — CSS does. Opted-in [data-layout] elements are batched-read (init + resize) and mapped to world space. Children are inferred from parent boxes when possible. That same pass pulls computed styles and detects line breaks, so WebGL text wraps exactly the same. SDF keeps smaller...

106,660 views • 6 months ago •via X (Twitter)

13 Comments

Johnny Slack's profile picture
Johnny Slack6 months ago

We recently shipped Shopify Design. 

 Here's a technical breakdown of how I built it. 🧵

Johnny Slack's profile picture
Johnny Slack6 months ago

Ortho to perspective in 16 floats. 

 In flat mode the camera uses orthographic projection — mirrors the DOM.
 On press-and-hold, all 16 matrix values lerp toward perspective with a cubic ease. Content lifts, FOV widens. One lerp gives a webpage depth.

Johnny Slack's profile picture
Johnny Slack6 months ago

Each photo is downsampled and split into 3–6 mesh planes by brightness — darks, mids, highlights.
 As you dive, they separate in depth. Block-noise “data moshing” displaces UVs per slice, while each color channel is sampled at slight offsets — creating the chromatic tearing through the image.

Johnny Slack's profile picture
Johnny Slack6 months ago

The dive is layered with shader-driven effects: RGB channel splitting tears through images, barrel warp bends the viewport, Voronoi cell noise pulses through the wireframe grid, and a particle field fills the space between.

Johnny Slack's profile picture
Johnny Slack6 months ago

The dive effect is driven by a post-process shader: edge detection + a noise-warped radial sweep + oscillating glow. Noise octaves control the crackle (scaled per GPU tier).
 Additional passes layer in radial zoom blur, barrel distortion, and vignette — all synced to the transition.

Johnny Slack's profile picture
Johnny Slack6 months ago

The reveal mask reuses the electric edge's shape to cut the canvas — transparent outside, WebGL inside. It's the final pass that pulls everything together, hiding any misalignment between DOM and 3D geometry right where the crackling edge sits.
 The effect isn't just aesthetic, it's structural.

 Final result slowed down ↓

Johnny Slack's profile picture
Johnny Slack6 months ago

See it live and don't forget to take the 💊 →

symbols's profile picture
symbols6 months ago

Cute

Glauber's profile picture
Glauber6 months ago

Inspiring and mind blowing - well done

Ste's profile picture
Ste6 months ago

is flash back?

fohyspek's profile picture
fohyspek6 months ago

how do you opt in the data layout elements? i feel like u imply that the opt-in is hardcoded. if i wanted to generalise this idea as a library what do you think would be the optimal strategy to intelligently do the opt-in. im thinking heuristics

Carlito's profile picture
Carlito6 months ago

This is absolutely insane!!

Dan Heywood's profile picture
Dan Heywood6 months ago

I’d love some sort of code demo on what this part specifically looks like. Sounds incredibly powerful to be able to create a layout normally and have it render inside three js

Related Videos