# Paint Ink on Scroll

Give each inked pixel an arrival time that follows the drawing. Vary the advancing brush edge with stable grain. Let the dark outlines appear first, then fine marks, then the final dry impression.

## Prepare one transparent drawing

Use a same-origin RGBA illustration with the paper removed and the original line density in alpha. Put it inside a positioned `.ink-drawing` wrapper. Keep the image in normal flow to establish its aspect ratio. Overlay a temporary canvas with the same bounds. Apply transforms, opacity and blend mode to the wrapper so the final handoff cannot jump. Keep foreground text and links separate.

See [painted-drawings.js](demo/assets/painted-drawings.js) for two brush paths. For independent watercolor and contour layers, schedule each layer separately. This example works with a single flattened ink plate.

## Choreograph the mark

1. Sketch the drawing order in normalized top-left coordinates. In the atlas, circle the compass from its center, follow Japan southwest and let the ink spread sideways. In the railway, draw overhead wires and uprights before the receding rails. For a new drawing, replace `atlas` or `railway` with its own path. For a winding river, use distance along the nearest segment for time and distance across it for the wash.
2. Compute a small timing field once at 720–864 pixels wide. Add low-frequency drift, two directional bristle waves and a little seeded noise. Keep randomness fixed across frames. Map the result to steps 2–192 on a 255-step clock.
3. Read source RGBA once. Skip empty pixels. Cache alpha offsets, original coverage and arrival steps in typed arrays. Delay each mark by `round(24 × exp(−.024 × alpha))` using the original 8-bit alpha. Dense contours lead faint hatching.
4. After arrival, ease coverage up over nine steps, briefly overshoot, then decay to the original value by step 39. Write only alpha. Reuse the same frame and skip duplicate steps. For oversized art, downsample the temporary canvas to the maximum display size before allocating arrays.

## Trigger and finish

Prepare the plate within 500 pixels of the viewport. Start when the actual drawing crosses an inset of 18% of viewport height, capped at 168 pixels. Wait for both intersection and image decoding. Use elapsed time for a 2.32 s railway or 2.59 s map. On completion restore the source image, remove the canvas and disconnect observers. A return scroll keeps the dry result. The example has a separate Replay ink control for inspection.

Check slow entry, a fast jump past the drawing, reverse scrolling and a mid-animation resize. Compare the finished linework with the original image. A sudden rectangular edge means the path needs more lateral variation. If the image flashes, prepare earlier and keep both layers aligned. Show the original immediately on reduced motion, missing canvas support or decode failure.

## Run the example

From this skill folder, run `python3 -m http.server 4173 --bind 127.0.0.1 -d demo` and open [the local demo](http://127.0.0.1:4173/). The demo runs without a build or remote assets. See the [preview](demo/preview.jpg) and [recreation prompts](demo/PROMPT.md).

Adapted from the Stillhertz landing page. Keep the host project's typography, subject and layout. Bring over only the relevant technique. The sample is a single page. For a routed application, cancel animation frames, remove listeners, disconnect observers and dispose GPU resources on unmount.

---

Copyright (c) 2026 Meng To

The license files are attached. [MIT](https://knowen.md/f/3c02f208-fea4-4055-a09c-593a4f764a38)

The attached ZIP contains the pinned supporting files cleared for import. Applicable license notices are attached or included when cleared.