Rack FocusPRO
A lens pull: heavy bokeh and colour fringing that rack down to tack-sharp.
Code
3 files · 200 lines of TypeScriptPRO
Rack Focus is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- The blur is a lens disc, not a gaussian: 24 taps on a golden-angle spiral, each read from a mip level that fills its share of the disc, with highlights weighted up so bright points open into bokeh.
- Red and blue focus at slightly different distances, so their discs differ in size and the fringe swaps colour as focus passes through. The frame breathes, zooming in slightly when out of focus, like a real lens.
- Near the end focus overshoots a little and settles back, like autofocus hunting, so the final sharpness reads as a lock rather than a fade. Turn it off with hunt={false}.
- The haze, exposure and vignette of a wide-open lens lift as focus lands. With reduced motion there is no hunt or focus drift, and focus closes in steadily with progress.
Usage
Example
<ImageFocus progress={job.progress} src={job.url} alt={prompt} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| progress | number | — | 0–100. At 100 the image is tack-sharp. |
| src | string | — | Final image URL. Same-origin or CORS-enabled. |
| alt | string | — | Alt text. |
| hunt | boolean | true | Overshoot through focus and settle back near the end. |
| className | string | — | Size it here; the default is w-64 at 3:4. |