Thinking UI

Depth ParallaxPRO

The image composited from depth: layers slide in at different distances and settle flat and sharp.

Code

3 files · 250 lines of TypeScriptPRO

Depth Parallax is part of Pro

Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.

Motion notes

  • A pseudo depth map comes from the blurred image: saturated, darker and central regions read as near, desaturated haze as far, with a gentle floor-is-near prior. It is softly terraced into layers, so the scene moves as stacked cards rather than a rubber sheet.
  • The scene opens on that depth pass. Far layers land first and near ones last, each displaced by its depth along an eased camera move with a slight perspective tilt and dolly. The displacement is solved per pixel with a few fixed-point steps on the depth map, so near layers occlude instead of smearing.
  • Depth of field follows a focus pull from far to near as the layers land, with haze on the far planes, then opens until everything is sharp. A small overscan and a slow dolly back keep displaced layers inside the frame.
  • While it generates the camera keeps a subtle micro-parallax drift, which fades out before 100 so the result sits perfectly flat. With reduced motion there is no drift and the layers follow progress directly.

Usage

Example
<ImageParallax progress={job.progress} src={job.url} alt={prompt} />

Props

PropTypeDefaultDescription
progressnumber—0–100. At 100 every layer has landed and the image is flat and sharp.
srcstring—Final image URL. Same-origin or CORS-enabled.
altstring—Alt text.
layersnumber6Number of depth layers the scene is split into.
classNamestring—Size it here; the default is w-64 at 3:4.