gatewai-dev/framefields/framefields-compose

Claude Code and agent skill by gatewai-dev/framefields

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Design, structure, and animate code-first video compositions using the framefields WebGPU SDK. Use when creating scenes, layout trees, kinetic typography, camera trajectories, vector shapes, or audio-synchronized motion graphics in framefields.

Install

npx vskill@latest install gatewai-dev/framefields/framefields-compose

SKILL.md

framefields-compose

Setup

Import everything from the `framefields` npm package. If the project doesn't have framefields set up yet, follow the framefields skill first (install, project scaffold, first render).

Overview

framefields is a code-first, deterministic video composition SDK executing natively on WebGPU (Dawn) in Node.js. It replaces browser-based rendering (Puppeteer/Chromium) with high-performance GPU pipelines, Yoga flexbox layout, Slug vector typography, 3D camera transforms, and reactive audio/signal drivers.

Every composition is defined as a tree of layout nodes compiled into a deterministic execution program: (composition, frame) → pixels.


Architecture & Core Concepts

1. Composition Lifecycle

A Composition instance defines canvas dimensions, frame rate, background, registered fonts, global audio tracks, and the layer hierarchy:

typescript
import { Composition, Layer, FontManager } from "framefields";
// Always register fonts before assembling layers
await FontManager.register({
family: "Inter",
source: "assets/fonts/Inter.ttf"
});
const comp = new Composition({
width: 1920,
height: 1080,
fps: 30,
durationMs: 10000, // or computeDuration()
backgroundColor: "#0E0D0C",
fonts: ["assets/fonts/Inter.ttf"],
});
comp.add(Layer.box({ /* ... */ }));
comp.add(Layer.audio("assets/score.mp3", { volume: 1 }));
2. Scene Architecture (Production Pattern)

For commercials, films, and multi-shot videos, break the project into discrete, modular scene functions using scene-local frames:

  • Tokens first (`theme.ts`): Centralize color palette, typography, easing curves, and a tempo-locked beat grid (BEAT = Math.round(fps * 60 / BPM)). Never use arbitrary margins or ad-hoc hex codes.
  • Scene modules (`scenes/hero.ts`): Each scene returns a full-frame root box with startFrame and durationFrames. Children position themselves relative to scene start (frame: 0 = scene onset).
  • Master assembly (`film.ts`): Imports scenes, mounts them to comp.add(scene()), attaches the master soundtrack and composition-level grading/grain.

For the exported Scene / Sequence builder, scene windows are half-open: [startFrame, startFrame + durationFrames). A root layer starting at local frame 30 in a 60-frame scene defaults to 30 frames of duration. Explicit root-layer windows must fit their scene; invalid starts or overflow throw with the scene and layer IDs. Children and their keyframes remain local to their parent. Outgoing overlaps place the next scene and cannot exceed either adjacent scene's duration. The final scene's outgoing overlap has no destination and does not shorten the timeline. calculateTimeline().totalFrames is the maximum exclusive scene end.

typescript
// theme.ts
export const W = 1920;
export const H = 1080;
export const FPS = 30;
export const BEAT = 18; // 100 BPM at 30 fps
export const beats = (n: number) => Math.round(n * BEAT);
export const INK = "#0E0D0C";
export const PAPER = "#EEE9E0";
export const EMBER = "#FF5A1F";
export function scene(options: { id: string; from: number; to: number; children: unknown[] }) {
return Layer.box({
id: options.id,
position: "absolute",
x: 0,
y: 0,
width: W,
height: H,
startFrame: options.from,
durationFrames: options.to - options.from,
children: options.children as never,
});
}

Layer Primitives (Layer.*)

All Layer.* builders return AnimatableNode<T> instances with chainable .animate(), .apply(), and effect methods.

BuilderNode kindDescription & Key Options
Layer.text(content, options)"text"Slug GPU vector text. Options: fontSize, fontFamily, fill, letterSpacing, lineHeight, align, direction, animators, spans. Arabic, Hebrew and Persian are shaped and laid out right to left automatically (direction: "auto"); set "rtl"/"ltr" to force it. align: "start"/"end" follow the direction.
Layer.box(options)"box"Rectangular container / card. Options: background, borderRadius, borderColor, borderWidth, overflow: "hidden", padding, children.
Layer.flex(options)"flex"Auto-layout container (Yoga). Options: `dir: "row" \"column", gap, justify, align, padding, wrap, children`.
Layer.video(src, options)"media"Video layer decoded via mediabunny. Options: `fit: "cover" \"contain", trimStartSec, muted, volume`.
Layer.image(src, options)"media"Static raster image (.png, .jpg, .webp). Options: `fit: "cover" \"contain". For vector animations (.json, .lottie), use Layer.lottie`.
Layer.svg(src, options)"media"Vector SVG asset. Options: fit: "contain".
Layer.lottie(src, options)"media"Lottie vector animation file (.json, .lottie). Decoded and rendered via ThorVG. Options: `fit: "contain" \"cover" \"fill", width, height`.
Layer.audio(src, options)"media"Audio track layer. Options: volume, startFrame, durationFrames.
Layer.shape(type, options)"shape"Parametric vector graphics ("rect", "circle", "ellipse", "polygon", "star", "arrow", "path"). Options: fill (a color or CSS gradient), d (SVG path data with arcs; keyframe it to morph shapes), strokeWidth, strokeColor, trimStart, trimEnd.
Layer.particles(options)"media"GPU particle system (see GPU Particles).
Layer.vfx(options)"media"Procedural full-frame VFX: smoke, fire, rain, snow, aurora… (see Procedural VFX).
Layer.caption(src, options)"media"SRT-driven synchronized subtitle engine. Bottom-anchored auto-wrapping cues.
Layer.chart(options, props)"box"Charts built from native nodes (d3 scales and geometry). type: `"line" \"area" \"bar" \"scatter" \"candlestick" \"pie" \"donut". Options: width, height, series: [{ name, data, color, type, curve, pointRadius }] or data, categories, stacked, xAxis/yAxis (min, max, ticks, grid, format: a d3-format string like "$,.0f"), legend, valueLabels, fontFamily, fontSize, colors, animate: { start, duration, stagger, ease } \false. props positions the chart box. Children get ids <id>-bar-<series>-<i>, <id>-line-<series>, <id>-slice-<i>`. Keep scatter charts to a few hundred points: each point is a node.
Layer.camera(options)"camera"3D scene camera with FOV, lens rack focus, and orbital coordinates.
Layer.light(options)"light"3D lighting primitive (ambient, directional, point, spot). Directional and spot take castShadow: true, shadowSoftness, shadowDarkness.
Layer.environment(preset, options)"light"The 3D scene's world: studio image-based light, exposure, tone mapping, fog, bloom. Adding one switches the scene to physically based shading. See 3D Look below.
Layer.sequence(entries, options)"box"Scenes back to back with Transitions between them; returns a box whose totalFrames is the length. See Scenes & Transitions.
Layer.model(options)"model3d"3D mesh loader (.gltf, .glb, .obj, .fbx, .stl, .ply). Supports skinning and audio deformation compute shaders.
Layer3D.roundedBox / sphere / cylinder / capsule / torus / ring / prism / pyramid / polyhedron / icosahedron / icosphere / shard(options)"model3d"Procedural solid meshes, centered on x/y/z (y is down, so "top" is -y). roundedBox: width, height, depth, radius, segments, taper. sphere: radius. cylinder: radius or radiusTop/radiusBottom, height, openEnded, flatShaded. capsule: radius, height (cylindrical shaft) or totalHeight. torus: radius, tubeRadius, arc. ring: flat annulus (innerRadius, outerRadius). prism / pyramid: solid capped flat-shaded N-gon prism or pyramid (sides, radius, height). polyhedron (`type: "tetrahedron" \"octahedron" \"dodecahedron" \"icosahedron"), icosahedron, icosphere (radius, detail, flatShaded). shard: procedural flat-faceted polyhedron rock/crystal (radius, cuts, irregularity, seed). Surface: color, tint, roughness, metallic, emissive, emissiveIntensity, material ("lit" \"glass" \"acrylic" \"frosted"), castShadow, wireframe`. Shared GPU buffers cache identical shapes.
Layer3D.extrude / lathe / tube / line / points(options)"model3d"Custom & path-driven 3D geometry. extrude: extrude a 2D SVG path d (with holes) or contour/holes (depth, bevelThickness, bevelSize, bevelSegments, bevelColor). lathe: revolve a 2D points profile [r, y][] around the Y axis (segments, phiStart, phiLength, closed, flatShaded). tube: sweep a solid or thick-walled hollow pipe (radius, innerRadius, radiusTaper, closed, capped) along a Path3D or 3D control points using rotation-minimizing frames. line: 3D polyline (points or Path3D, dashSize, gapSize, per-vertex colors). points: 3D point cloud (points, pointSize for lit sphere dots or 0 for point-list, per-point colors).
Layer3D.instances(options)"model3d"Hardware-instanced single or multi-variant mesh rendering in 1 GPU draw call. Options: count, mesh / meshes (array of Layer3D primitives or meshes), instanceAt(index, frame): { position, rotation, scale, color, emissive }, or bind directly to Rapier Physics.world3d bodies via bodies: Body3D[] with emissiveBySpeed and colorRamp.
Layer3D.swarm(options)"model3d"Continuous 3D GPU particle swarm with compute-driven physics, 3D curl turbulence, vortex/cyclone field (swirl, pull, axial), ground plane collisions with Coulomb sliding friction and rotational roll torque, kinetic heat accumulation/cooling, and zero-copy packing directly into GPU instance buffers.

Media time remapping

Layer.ambientLight({ color, intensity, id }) and Light.ambient({ color, intensity, id }) accept options objects like the other light helpers; the positional (color, intensity, options) form remains supported. Animation-builder instances passed through a layer's animation option are normalized to program specs, including CameraAnimation.

Video and audio layers accept timeRemap with an explicit durationFrames. Map frames are layer-local; sourceSec is absolute source time. Increasing source times play forward; decreasing source times play in reverse; equal source times hold the picture and silence the audio. Rate changes also change audio pitch. Do not combine this with trimStartSec.

ts
const clip = Layer.video("assets/clip.mp4", {
durationFrames: 90,
timeRemap: { kind: "keyframes", keyframes: [
{ frame: 0, sourceSec: 1, interpolation: "smooth" },
{ frame: 30, sourceSec: 2 }, { frame: 45, sourceSec: 2 },
{ frame: 90, sourceSec: 1 },
] },
});
comp.add(clip);
const vision = comp.vision(clip);
// Or: timeRemap: { kind: "rate", sourceStartSec: 3, rate: -0.5 }

A signal can drive the clock instead: { kind: "signal", mode: "speed", signal, sourceStartSec } integrates playback rate (source seconds per second; negative reverses, 0 holds), and mode: "source-time" reads absolute source seconds. signal is a Signal or the name of a composition signal (comp.addSignal), read on the composition clock at every layer frame boundary and interpolated between them, so picture, audio and comp.vision share one clock.

ts
const speed = Signal.state(1);
comp.onRequestFrame((ctx) => speed.set(ctx.frame < 48 ? 1 : 0.25));
comp.add(Layer.video("assets/clip.mp4", {
durationFrames: 96,
timeRemap: { kind: "signal", mode: "speed", signal: speed },
}));

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/gatewai-dev/framefields/framefields-compose/badge)](https://verified-skill.com/skills/gatewai-dev/framefields/framefields-compose)

Something wrong with this skill or its page? Tell us.