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

commotion-engine

v0.1.0

Published

Rust-powered animation engine for LLM-authored motion graphics — validate, render, and animate JSON scenes in the browser via WebAssembly

Readme

commotion-engine

Rust-powered animation engine compiled to WebAssembly. Create, validate, and render animated scenes from JSON descriptions.

Install

npm install commotion-engine

Usage

import init, { Commotion } from 'commotion-engine';

await init();

const engine = new Commotion();

// Validate a scene
const diagnostics = engine.validate(JSON.stringify({
  width: 960,
  height: 540,
  background: "#1a1a2e",
  layers: [
    { type: "text", content: "Hello", position: ["50%", "50%"], size: 48, fill: "#ffffff", align: "center" },
    { type: "circle", center: [480, 400], radius: 60, fill: "#3b82f6" }
  ]
}));

// Load and render
const handle = engine.load_scene(sceneJson);
const info = JSON.parse(engine.sceneInfo(handle));
const rgba = engine.render_frame_rgba(handle, 0.0); // Uint8Array of RGBA pixels

// Draw to canvas
const canvas = document.getElementById('canvas');
canvas.width = info.width;
canvas.height = info.height;
const ctx = canvas.getContext('2d');
const imageData = new ImageData(new Uint8ClampedArray(rgba), info.width, info.height);
ctx.putImageData(imageData, 0, 0);

API

new Commotion()

Create an engine instance.

.validate(json: string): string

Validate a scene JSON string. Returns JSON with { errors: [...] }.

.load_scene(json: string): number

Load a scene and return a handle for rendering.

.sceneInfo(handle: number): string

Get scene metadata (width, height, fps, duration, layer IDs).

.duration(handle: number): number

Get the total animation duration in seconds.

.render_frame_rgba(handle: number, t: number): Uint8Array

Render a frame at time t (seconds). Returns raw RGBA pixel data.

Commotion.schema(): string

Get the full JSON Schema for the scene format.

Commotion.compactSchema(): string

Get a compact schema reference (useful as LLM context).

Commotion.generateSpeechTrack(script: string, wpm: number): string

Generate timed speech segments from a script.

Commotion.buildSubtitleTrack(speechJson: string, maxWordsPerCue: number): string

Build subtitle cues from a speech track.

Scene Format

Scenes are JSON objects with layers, animations, and sequences:

{
  "width": 960,
  "height": 540,
  "fps": 30,
  "background": "#0a0a1a",
  "layers": [
    {
      "type": "text",
      "content": "NEON",
      "position": ["50%", "50%"],
      "size": 72,
      "fill": "#00e5ff",
      "align": "center",
      "text_style": { "neon": { "glow_color": "#00e5ff" } }
    }
  ],
  "sequences": [
    {
      "name": "intro",
      "animations": [
        { "target": "layer_0", "effect": "fade_in", "duration": 1.0 }
      ]
    }
  ]
}

Supports: shapes, text (with neon glow), charts, paths, groups, blend modes, masks, spring physics, stagger animations, and more.

License

MIT