⚠ Early release: v0.3.2.sophistry is not ready for production use. Until 1.0, any minor release may break the API; expect missing features and bugs too.Stability and versioning
@sophistry/core
Animation you can steer
pnpm add @sophistry/core @sophistry/solidjs
What you get
Section titled “What you get”Show me the code
Section titled “Show me the code”A scene is a tree of nodes. In Solid it is an ordinary component; tracks are
the source of truth and bind straight into the scene graph, a Canvas2D
renderer paints it, and a timeline gives you a controller you can play,
pause and seek. The same scene can be built without a
framework or in
React.
17 collapsed lines
import { derive, draw, moveTo, sequence, track, trackPoint,} from "@sophistry/core";import { Circle, Dot, Stage, Text, usePlayer, useTrackValue,} from "@sophistry/solidjs";import { onSettled } from "solid-js";
export function ScrubDemo() { const drawn = track(0); const dot = trackPoint(2, 0);
// One animation value, one seekable controller. const tl = usePlayer().timeline( sequence( draw(drawn, { duration: 2 }), moveTo(dot, { x: 0, y: 2 }, { duration: 1 }), ), ); const time = useTrackValue(tl.time); onSettled(() => void tl.play());
return ( <div class="scrub-demo"> <Stage units={8}> <Circle center={{ x: 0, y: 0 }} radius={2} progress={drawn} /> <Dot center={dot} /> <Text text={derive(tl.time, (t) => `t = ${t.toFixed(2)} s`)} y={-2.6} /> </Stage> <input type="range" aria-label="Scrub the timeline" min={0} max={tl.duration} step={0.01} value={time()} onInput={(e) => { tl.pause(); tl.seek(Number(e.currentTarget.value)); }} /> </div> );}Live: it plays, then scrub it, backwards too. Seeking restores start values.
See it move
Section titled “See it move”Every thumbnail below is a live scene from the gallery.
One core, any framework
Section titled “One core, any framework”The core, @sophistry/core, is plain TypeScript with no UI framework
dependency: a retained scene graph that recomputes only what a write
touches, instancing for thousands of items in one node, and a renderer
behind a clean spec boundary. The Solid and React bindings are generated
from the core’s definitions, so every shape, chart and composite is a
component in both. See Core concepts.
The library is pre-1.0, and the Solid binding targets Solid 2, so the API may still change. What that means in practice, and what we promise between releases, is in Stability and versioning.
Packages
Section titled “Packages”@sophistry/core plus a binding (@sophistry/solidjs or
@sophistry/react), or the core alone. LaTeX, charts and 3D are separate
packages (@sophistry/text, @sophistry/charts,
@sophistry/3d), so you only bundle what you import. See
Installation.