A streaming chart · TanStack Charts
The trend icon follows the series: when the trend turns, the icon and its color turn with it. Nudge the drift to flip it.
canvasTarget draws the morph into any canvas or 2D context: a texture inside a map, a sprite in a chart, a favicon, an OffscreenCanvas in a worker.
The trend icon follows the series: when the trend turns, the icon and its color turn with it. Nudge the drift to flip it.
Each pin is a Mapbox image drawn by a morphing canvas. Drop one, hover it, save it.
One adapter call around the DOM driver. The rest of the demos above is the host compositing these pixels.
import { createMorph } from "morphicons/dom";
import { canvasTarget } from "morphicons/adapters";
import { Flag, MapPin } from "lucide"; // data, not components
const sprite = document.createElement("canvas");
sprite.width = sprite.height = 64;
const morph = createMorph(
canvasTarget(sprite, { color: "#fff", onWrite: () => map.triggerRepaint() }),
MapPin,
);
morph.morphTo(Flag, "smooth");
// the canvas is pixels you own: a Mapbox StyleImage, a chart badge,
// a WebGL texture, a favicon, an OffscreenCanvas in a worker
Mapbox GL and the chart runtime load only when their card scrolls into view. The save wave is Canvas UI's Ripple shader (MIT + Commons Clause).