Upscale LoupePRO
A magnifier glides over a softened image, showing the upscaled 4× detail inside.
Code
1 file · 191 lines of TypeScriptPRO
Upscale Loupe is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- The loupe trails its target on a slow, zero-bounce spring, so pointer jitter and jumps between points become one smooth glide.
- The base image is softened and flattened a little, so the crisp, slightly richer detail in the lens reads as the upscale without a split view.
- The zoomed layer is zoom× the frame and shifted by a percentage of its own size, so one motion value drives both the lens position and what it shows.
- Focusable with arrow-key steps (Shift for bigger ones). With reduced motion the lens jumps straight to each point.
Usage
Example
<UpscaleLoupe
src={original.url}
detailSrc={upscaled.url}
alt={prompt}
zoom={4}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| src | string | — | The image, shown softened under the loupe. |
| detailSrc | string | — | A sharper or upscaled source for the lens. Defaults to src. |
| alt | string | — | Describes the image for screen readers. |
| zoom | number | 4 | Magnification inside the loupe, also shown on its badge. |
| size | number | 112 | Loupe diameter in px. |
| position | { x: number; y: number } | — | Controlled lens center, in percent of the image. |
| defaultPosition | { x: number; y: number } | { x: 50, y: 50 } | Starting center when uncontrolled. |
| onPositionChange | (position: { x: number; y: number }) => void | — | Called on pointer move and arrow keys. |
| interactive | boolean | true | Follow the pointer and arrow keys. |
| className | string | — | Size it here; the default is w-64 at 3:4. Match the image's aspect ratio. |