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

@motionscript/grids

v0.4.0

Published

Grid layouts for Motion Script: rectangular, radial, path and spherical arrangements of a node's children, with staggered reveals, waves, focus and morphs between them.

Readme

@motionscript/grids

Grid layouts for Motion Script: a node that places its children in a rectangular, radial, path or spherical arrangement, with staggered reveals, waves, focus, reordering and morphs between arrangements. Written against @motionscript/sdk, a peer dependency.

import { NODES } from '@motionscript/grids';

export const nodes = NODES; // [RectangularGrid, RadialGrid, PathGrid, SphereGrid]

Importing registers nothing (see packages/components/CLAUDE.md). Each grid is a component (component2d); ItemGrid, the module the four are built from, is no node type and is not in NODES.

Install

npm install @motionscript/grids @motionscript/sdk

Exports

| Path | Source | What | |---|---|---| | @motionscript/grids | src/index.ts | the public surface: the four grids and NODES. A name leaves it only after a deprecation, in the next major (the next minor while on 0.x) | | @motionscript/grids/v1 | src/v1.ts | the v1 public surface, the same names as the root today. A custom component imports this path, so a later major keeps it linking; the bare path follows the latest API | | @motionscript/grids/kit | src/unstable.ts | everything: the ItemGrid module and what it uses (src/engine.ts, over src/kit/: slot functions per arrangement, stagger, reveal and wave styles, order helpers, seeded random) and the four grid barrels (PATH_GRID_SHAPES, …). Unstable: any release may change it |

Nodes

The items are the grid's children, in layer order; a group is one item. A grid is hug by default, except pathGrid (640 x 400, fixed).

| Key | Arrangement props | Own commands | |---|---|---| | rectangularGrid | columns, fillDirection, cellMode (fit/fixed/fill), cellWidth/Height, columnGap, rowGap, lastLineAlign, rowOffset, columnOffset | columnsTo, gapTo, cellSizeTo, focusRow, focusColumn | | radialGrid | radius, startAngle, sweep, direction, rotateItems, spinSpeed | spin, turnTo, radiusTo, sweepTo | | pathGrid | shape (a template or custom), path, pathNode, spacing, spacingDistance, offset, flowSpeed, trimStart/End, alignToPath | flow, trimTo, setPath | | sphereGrid | radius, yaw, pitch, roll, facing, focalLength, depthFade, cullBackfaces, spinSpeed | spin, orientTo, turnTo, radiusTo, focalLengthTo |

Every grid also has order, spread and arrangeLike, and these commands from the ItemGrid module: reveal, conceal, wave, focus, unfocus, spreadTo, shuffle, swap, reorder, morphInto. Per-item commands take staggerOrder (index, reverse, random, centerOut, edgesIn, row, column, angle, path, depth) and stagger (0 to 0.95); shuffle, swap, reorder, morphInto, columnsTo and setPath are transitions.

Rules worth knowing

  • A slot is a parent transform. Each item is laid out where its slot is, and the rest of the slot (turn, scale, tilt, depth, fade) rides on its layout placement, applied about the item's centre before its own transform, so an item's own x, y, rotation and its commands keep working relative to the slot. A grid whose arrangement has depth (the sphere) opens a camera of its own with its render's ctx.space, unless it already sits in a space (ctx.inSpace).
  • flowOps sizes; it never places. The grid's size is what its slots come to (extentOf), seen through the camera it has that frame, so a grid of grids is a grid of items.
  • revealState, waveState, focusState and transition are written by commands, not authored. They are rewritten every frame as a pure function of time and set to null at the command's end, so a seek reproduces them. reveal hides every item at its start (place it where the grid enters); conceal leaves them hidden until a later reveal.
  • The stagger lives inside the duration: a command lasts its row's duration.
  • An arrangement is data. A transition keeps the arrangement it leaves as a GridSnapshot and re-evaluates it each frame, so a morph can start from any arrangement, including another grid's. morphInto writes arrangeLike (a node reference: the grid reads a view of the one it names, and where it stands) and keeps following that grid; a grid that cannot find arrangeLike or pathNode draws its own arrangement. Another grid's arrangement is worked out from its state by the Arranger it was defined with, so a grid is borrowable once ItemGrid.define has seen it.
  • A command reads the grid as its predecessors leave it. Ranks for a stagger, the rows focusRow picks and the cell cellSizeTo starts from are worked out afresh from the command's state, its children's sizes and the grid's box, against the clock the timeline builds commands at (time 0).
  • order[k] is the child in slot k, and normalizeOrder repairs any order (missing, repeated or out-of-range entries), so a stale order never throws.
  • The kit stays an import. A copy of rectangular-grid (or radial-grid, path-grid, sphere-grid) takes one grid's two files and rewrites their kit imports to @motionscript/grids/kit (registry.json): a second copy of ItemGrid would keep a second register of grids, and a morph would not find the grids it should.

A grid of your own

import { component2d, Types, type Values } from '@motionscript/sdk';
import { ItemGrid, type Arrangement } from '@motionscript/grids/kit';

const own = { radius: Types.number(120) };
const arranger: ItemGrid.Arranger<Values<typeof own>> = {
  arrangement: (s): Arrangement => ({ kind: 'radial', radius: s.radius, startAngle: 0, sweep: 180, direction: 'clockwise', rotateItems: false, spinSpeed: 0 }),
};

export const ArcGrid = ItemGrid.define(component2d({
  key: 'arcGrid',
  state: { ...ItemGrid.state, ...own },
  defaults: ItemGrid.defaults,
  commands: { ...ItemGrid.commands },
  ...ItemGrid.fields(arranger),
}), arranger);

define registers the arranger, which is what another grid and a host know it by: ItemGrid.isGrid(node) tells a grid from any other node.

Development

pnpm --filter @motionscript/grids build
pnpm --filter @motionscript/grids test

Tests are in src/tests/ (grid.test.ts, slots.test.ts, descriptors.test.ts); harness.ts builds, seeks and renders a document.