Pixel Canvas
A 96 by 96 canvas redrawn from code and scaled up with hard edges. Inside a ScrollScene it follows the scroll, with an optional clock for steam, bubbles and sway.
import { PixelCanvas, PixelSteps, shapes } from "pleate/effects/pixel-art";A flower growing
Scroll the page. Nothing here is an image.
A seed
It drops into the pot as you start to scroll.
A stem
Every row of pixels is drawn again for each point of the scroll.
Leaves
Scroll back and they fold up again.
A flower
Only the sway and the pollen move on their own clock.
- A seed
- A stem
- Leaves
- A flower
Props
- draw(p, { progress, time })
Draws one frame on a cleared PixelBuffer.
function- size
Pixels on each side.
numberdefault 96- progress
Defaults to the enclosing ScrollScene's progress.
MotionValue<number>- animate / fps
Run the clock, at this many frames per second.
boolean / numberdefault false / 12- label
Accessible name of the picture.
string
Accessibility
- Reduced motion stops the clock; the scroll still drives the picture.
- Nothing draws off screen or in a hidden tab.
- Theme colors are read again when the theme or the palette changes.