# Motion SDK

> An agent-native Rust/WebGPU alternative to Three.js. Scenes are JSON, streamed as patches, validated with structured errors, and rendered the same way every time in the browser, natively or headless to MP4.

Write scenes in TypeScript with `@motion-sdk/scene` (types generated from the spec, typed helpers, path-checked patches; see the TypeScript SDK page) and check them with `tsc` and `validate()` from `@motion-sdk/core/validate`.

Read a page as Markdown by adding `.md` to its URL. `/llms-full.txt` has every page in one file.

## Get Started

- [Get Started](/docs/index.md): Install the CLI, give your agent the skills, and render your first scene in a minute.

## Concepts

- [Introduction](/docs/concepts.md): Why Motion SDK exists, and how the spec, the renderer and the exports fit together.
- [Installation](/docs/concepts/installation.md): Install the CLI for headless renders, the Rust crates, and the browser player.
- [Your First Scene](/docs/concepts/first-scene.md): Build a scene step by step, check it with the validator, and render a frame and a loop.
- [TypeScript SDK](/docs/concepts/typescript.md): Write scenes as type-checked TypeScript with @motion-sdk/scene. Generated types, typed helpers, path-checked patches and the engine's validator.
- [The Scene Document](/docs/concepts/scene-document.md): The few shapes every part of the spec follows, so an agent writes it right the first time.
- [Streaming Patches](/docs/concepts/streaming.md): Send a scene as RFC 6902 patches. Every accepted patch leaves a scene that renders.
- [Validation](/docs/concepts/validation.md): Every issue has a JSON Pointer path, a message and a suggested fix, often a ready patch.
- [Determinism](/docs/concepts/determinism.md): Same spec, same seed, same pixels. That's what makes tests, diffs and exports reliable.
- [Runtimes](/docs/concepts/runtimes.md): The browser player, native rendering and headless export all share one renderer.

## Features

- [Features](/docs/features.md): Everything a scene can hold, one page per feature, each with an example, a render and every property.
- [Nodes](/docs/features/nodes.md): The scene graph, a map of nodes keyed by id, with parents, transforms, visibility and tints.
- [Geometry](/docs/features/geometry.md): Ten procedural shapes, plus glTF models, drawn with a material.
- [Instancing](/docs/features/instancing.md): Draw any number of copies of a mesh in a single draw call.
- [Text](/docs/features/text.md): 3D text from bundled fonts, with depth, wrapping and entrance animations.
- [SVG Drawings](/docs/features/svg.md): Draw vector art as SVG, then rig and animate it by its element ids.
- [Rigging](/docs/features/rigging.md): IK chains, constraints and planted feet, so a few goals drive a whole character.
- [Materials](/docs/features/materials.md): Physically based materials with 16 presets, flat and toon shading, outlines and procedural surfaces.
- [Textures](/docs/features/textures.md): Images on materials for logos, signs, screens, posters and tiles.
- [Water and Floods](/docs/features/water.md): Rolling waves and a real planar reflection for seas, lakes and wet roads, plus simulated flood water that flows and floats things.
- [Lighting](/docs/features/lighting.md): Seven tuned light rigs, custom lights, lights that ride on nodes, and soft shadows.
- [Fog](/docs/features/fog.md): Distance fog that melts scenery into the sky, and scatters light into visible beams.
- [Sky and Environment](/docs/features/sky.md): Backgrounds, a procedural sky with sun, clouds, haze and horizon glow, and reflections.
- [Post Effects](/docs/features/post.md): Bloom, mist, exposure, tone mapping, colour grading, depth of field, grain and vignette.
- [Stylise](/docs/features/stylise.md): Make flat art read as inked and printed - hatching, ink outlines, paper, halftone, speckled colour, line boil and light shafts.
- [Pixel Art](/docs/features/pixel-art.md): Draw the scene at a low resolution, snap it to a palette with ordered dither and outlines, and show it as crisp squares.
- [Gaussian Splats](/docs/features/splats.md): Draw surfaces as clouds of soft discs, sampled from signed-distance shapes with baked light or loaded from .ply and .splat captures.
- [Terrain](/docs/features/terrain.md): Seeded heightfields for ground, hills and mountains, with flat areas for lots and roads.
- [Scatter](/docs/features/scatter.md): Thousands of rocks, bushes or trees on a terrain in one instanced draw.
- [Models and Rigs](/docs/features/models.md): Import glTF 2.0 models, play their animation clips, and bend any mesh with bones.
- [Modelling Kit](/docs/features/modelling.md): Build realistic objects in TypeScript with Blender-style operations (extrude, bevel, lathe, loft, sweep, subdivision, booleans, SDF blends), a procedural humanoid and a sedan, then hand them to the engine as glTF.
- [Physics](/docs/features/physics.md): Rigid bodies that fall, tumble and collide, joints that link them, cloth that drapes, and soft pads that squash on contact.
- [Camera](/docs/features/camera.md): Perspective or orthographic, a target to look at, and eight move presets.
- [Shots](/docs/features/shots.md): An ordered shot list with hard cuts, camera flights through waypoints, and follow cams.
- [Timeline and Keyframes](/docs/features/timeline.md): Tracks of keyframes on any property, smooth curves, spring follow-through and loop modes.
- [Easing and Springs](/docs/features/easing.md): 21 easing curves, three spring presets, custom springs, cubic-bezier and steps.
- [Paths and Signals](/docs/features/paths.md): Curves for nodes to follow, traffic that queues at lights, crowds, and cycling signals.
- [Prefabs and Repeat](/docs/features/prefabs.md): Write repeated parts once, as templates with parameters, placed many times.
- [Expressions](/docs/features/expressions.md): A small, deterministic expression language for prefab parameters and copies.
- [Particles](/docs/features/particles.md): Seeded particles for sparks, snow, smoke, spray, embers, confetti, trails and streaks.
- [State Machines](/docs/features/state-machines.md): Interactive scenes with states that play or scrub clips, triggered by hover, click, scroll, keys and timers.
- [Export](/docs/features/export.md): MP4, GIF and PNG from the CLI, with social presets, safe areas, captions, seamless loops and motion blur.
- [2D Motion Graphics](/docs/features/motion-graphics.md): Flat, fast-cut launch promos and UI animations with an orthographic camera.

## Reference

- [Reference](/docs/reference.md): The scene schema, patches, the player API, the CLI and every validation code.
- [Scene](/docs/reference/scene.md): The top-level scene document and an index of every type in the schema.
- [Patches](/docs/reference/patch.md): The JSON Patch operations a scene accepts, how they apply, and the report you get back.
- [Player](/docs/reference/player.md): The browser API in @motion-sdk/core. Load a scene into a canvas, stream patches, and drive it from code.
- [CLI](/docs/reference/cli.md): Validate, expand and render scenes from the terminal with motion-sdk.
- [Error Codes](/docs/reference/errors.md): Every validation code, with a scene that triggers it and the exact message and fix the validator returns.

## Guides

- [Guides](/docs/guides.md): Recipes for real work, like recreating a reference video, exporting for social, and performance.
- [Recreate a Reference Video](/docs/guides/recreate-a-reference-video.md): Turn a clip you like into a Motion SDK scene. Break it into shots, block it out, then match the look.
- [Walk Cycles](/docs/guides/walk-cycle.md): Walk a character with planted feet in a few lines, from the side, the front or three-quarters.
- [Social Exports](/docs/guides/social-exports.md): Render MP4s and GIFs for X, LinkedIn, Instagram and TikTok that fit each platform and loop cleanly.
- [Plugins](/docs/guides/plugins.md): Extend Motion SDK with opt-in packages that add agent skills, typed scene helpers, CLI commands and verify checks, starting with img2scene, which rebuilds a prop from a photo.
- [WebXR](/docs/guides/webxr.md): Put a scene in a VR or AR headset with the opt-in @motion-sdk/core/xr entry, stereo rendering from the headset's poses, and controllers and hands as scene nodes.
- [Performance](/docs/guides/performance.md): Bundle sizes, frame times, scene sizes in tokens, and an honest comparison with Three.js.

## Agents

- [Agents](/docs/agents.md): Motion SDK is built for agents. Here's how to give yours the right context.
- [Build With an Agent](/docs/agents/build-with-an-agent.md): The loop an agent follows to make a scene. Write, validate, verify, render, look, fix.
- [Verify Motion](/docs/agents/verify.md): Check that a scene does what the brief asked for. The ball moves right, the title comes first, nothing leaves the frame. Then fix what fails and check again.
- [Skills](/docs/agents/skills.md): Agent Skills that teach an agent to write, direct, light, animate, export and debug Motion SDK scenes.
- [llms.txt](/docs/agents/llms-txt.md): Every docs page as Markdown, in one file or one page at a time, for any model.
