Inpaint BrushPRO
A brush paints a mask over part of an image, then just that region regenerates.
Code
2 files · 288 lines of TypeScriptPRO
Inpaint Brush is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- The stroke draws with pathLength on an ease-in-out, and the brush outline rides its tip, sized to the real brush so you see exactly what gets masked.
- While the region regenerates, marching ants circle the mask: diagonal stripes sliding through a thin ring cut from the stroke's outline, with a soft glow.
- The new pixels show through a feathered copy of the same stroke and resolve from blur to sharp, so the edit blends into the untouched image.
- Pure SVG and CSS masks, no canvas. With reduced motion the stroke appears at once, the ants hold still and the result cross-fades.
Usage
Example
<InpaintMask
src={image.url}
resultSrc={edit.url}
path={strokePath}
stage={edit.status}
prompt="Make the crab blue"
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| src | string | — | The source image. |
| stage | "idle" | "painting" | "regenerating" | "done" | — | Controlled stage of the edit. |
| resultSrc | string | — | The regenerated image. Leave it out to show `src` through `resultFilter`. |
| resultFilter | string | "hue-rotate(170deg) saturate(1.3) brightness(1.05)" | CSS filter for the regenerated region when there's no `resultSrc`. |
| alt | string | — | Alt text for the image. |
| path | string | — | The brush stroke as an SVG path in `viewBox` coordinates. Defaults to a scribble over the lower left. |
| viewBox | string | "0 0 300 400" | Coordinate space of `path`. Its ratio sets the frame's aspect. |
| brushSize | number | 34 | Brush diameter in `viewBox` units. |
| paintDuration | number | 1.8 | Seconds the stroke takes to paint. |
| prompt | string | — | The edit instruction, shown once the mask is down. |
| className | string | — | Size it here; the default is w-64. |
