Thinking UI

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

PropTypeDefaultDescription
srcstring—The source image.
stage"idle" | "painting" | "regenerating" | "done"—Controlled stage of the edit.
resultSrcstring—The regenerated image. Leave it out to show `src` through `resultFilter`.
resultFilterstring"hue-rotate(170deg) saturate(1.3) brightness(1.05)"CSS filter for the regenerated region when there's no `resultSrc`.
altstring—Alt text for the image.
pathstring—The brush stroke as an SVG path in `viewBox` coordinates. Defaults to a scribble over the lower left.
viewBoxstring"0 0 300 400"Coordinate space of `path`. Its ratio sets the frame's aspect.
brushSizenumber34Brush diameter in `viewBox` units.
paintDurationnumber1.8Seconds the stroke takes to paint.
promptstring—The edit instruction, shown once the mask is down.
classNamestring—Size it here; the default is w-64.