npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@spirograph/anim

v0.1.2

Published

Optional spirograph animation driver library: injectable frame scheduler (rAF/Node timer) + drawing animation + frame-plan computation, used with @spirograph/core

Downloads

524

Readme

@spirograph/anim

Optional animation driver for the spirograph: decides how much to draw at a given progress (frame plans) and schedules the drawing rhythm. It pairs with @spirograph/core — add it only when you need the simulated "pen tracing the pattern" animation.

What it adds (and what it deliberately doesn't)

  • No pollution of core — all animation math lives in core's pure data operations (buildRenderData's perPenLimit prefix truncation, computeSteps, computeGearPose). This library only handles scheduling and frame plans; it never stuffs timers / DOM into core.
  • Injectable scheduler — browsers / RN use requestAnimationFrame, Node falls back to setTimeout; the FrameScheduler interface is plug-and-play.
  • Cross-platform consistencycreateFramePlan is a pure function; the browser canvas and a future react-native-svg consume the same frame plan.

Install

npm install @spirograph/anim @spirograph/core

Usage

import { createFramePlan, DrawAnimation, autoScheduler } from '@spirograph/anim';
import { buildItems, computeBounds, computeTransform, buildRenderData } from '@spirograph/core';

const items = buildItems(state);
const t = computeTransform(computeBounds(items.map(i => i.curve)), 800, 800, 32);

// Per frame: how much each pen draws at a given progress (pure function)
const plan = createFramePlan(items, 0.42, { step: true });
const data = buildRenderData(items, t, { perPenLimit: plan.perPenPoints.map(n => Math.max(0, n - 1)) });

// Drive the animation (scheduler injectable)
const anim = new DrawAnimation(
  (progress) => renderFrame(createFramePlan(items, progress, { step: true })),
  () => renderFinal(),
  15_000,          // base duration ms
  autoScheduler(), // browser/RN rAF; Node auto-falls back to timer
);
anim.setSpeed(2);
anim.start();
anim.pause(); anim.resume(); anim.stop();

Schedulers

| Scheduler | Platform | Description | |---|---|---| | rafScheduler() | browser / RN | global requestAnimationFrame + performance.now; falls back to ~16ms timer without rAF | | timerScheduler() | Node | setTimeout fallback (~16ms) | | autoScheduler() | any | uses rAF when available, otherwise timer (default) |

Spirograph Generator (live demo)

The Spirograph Generator is the browser demo UI that drives this animation driver — a vanilla <canvas> editor where the gear/pen model can be tweaked live and animated, with PNG / SVG export and URL-based sharing.

▶ Try the full app — no install needed: https://leiwan5.github.io/spirograph/

Sibling packages

@spirograph/* is a small npm-workspaces monorepo — every package is a thin adapter or layer around the shared pure core, so colors, math, and animation frames stay pixel-consistent across renderers. The other independently publishable packages:

| Package | What it is | |---|---| | @spirograph/core | Pure cross-platform math, gradients, SVG/PNG generation — zero DOM / Node deps | | @spirograph/canvas | Browser-only Canvas 2D glue: renderer + PNG/SVG export helpers | | @spirograph/react | React <SpirographCanvas> / <SpirographAnimated> | | @spirograph/svelte | Svelte 5 <SpirographCanvas> / <SpirographAnimated> | | @spirograph/react-native | React Native SVG components on react-native-svg | | @spirograph/cli | CLI: URL-query / JSON → PNG / SVG files |

Build / publish

npm run build   # tsc -b → dist/

↳ Part of the spirograph-generator monorepo. See it animate live at https://leiwan5.github.io/spirograph/.