SlopCamera
Browse documentationHow-to guides · Render motion graphics from HTML

How-to guides

Render motion graphics from HTML

Choose an HTML, SVG, Motion, p5, Two.js, shader, or Three.js scene, render a video, and retain sources for revisions and overlays.

Use slopcamera html render to turn authored HTML, SVG, Canvas, shaders, or Three.js into a video while retaining the document, assets, render request, and an editable project. All seven HTML profiles ship in v3.10.3; each needs its admitted local browser and FFmpeg/FFprobe. The source files below were authored later and live in the current repository.

For a first guided render, use Create and revise your first animation. This guide assumes an installed CLI, a chosen graphic, and a current repository checkout containing examples/showcase/html/. Run commands from that checkout's root so resource paths resolve correctly.

Choose a source for the graphic

Use the simplest profile that owns the visual decisions you need. The motion atlas contains original sources and render requests:

GraphicProfileSupplied request and technique
Editorial titleHTML/SVGeditorial.json: typography and animated SVG ellipses; a second request changes the copy and ink
Kinetic typographyMotionkinetic-title.json: seeked text reveals and staggered bars
Procedural drawingp5contour-drift.json: contours redrawn from absolute time
Vector choreographyTwo.jsorbital-assembly.json: retained circles arranged in named orbits
Shader backgroundPaper Shadersliving-colour.json: a time-controlled color field beneath type
Custom GPU fieldvgpuinterference-field.json: an authored full-screen WGSL pass
3D scene with musicThree.jsisland-pulse.json: an articulated robot, island, and declared musical clock
Lower thirdHTML/SVGlower-third.json: a transparent source, previewed over a colored plate

These are different authoring tools inside one export workflow. The Three.js example uses named rigid joints; it does not demonstrate imported skinning or a physical simulation. The vgpu browser profile renders raster frames; it does not share GPU textures with Three.js. Choose an HTML authoring surface covers those boundaries in detail.

Inspect the profile and request

slopcamera doctor --json
slopcamera html catalog --json
slopcamera help html
slopcamera html render --input examples/showcase/html/editorial.json --dry-run --json

Inspect the request's document path, canvas, timing, library selection, and declared resources. Copy a request before changing it. Keep the document inside the workspace and supply every image, font, or other asset through its resource declarations; the renderer does not grant ambient network access to a page.

Use SlopcameraOverlay.onFrame to derive every frame from the supplied absolute time. A minimal pattern is:

SlopcameraOverlay.onFrame(({ timeMs }) => {
  const seconds = timeMs / 1000;
  const angle = Math.sin(seconds) * 12;
  document.querySelector("#title").style.transform = `rotate(${angle}deg)`;
});

Register the callback when the module starts. Put asynchronous asset preparation in the promise passed to SlopcameraOverlay.ready(...). Do not advance animation by wall-clock delays or by counting previous callbacks: a renderer can request a frame independently. The supplied scaffolds demonstrate each library's time and readiness contract.

Render and retain the result

HTML timeline

Form follows a frame

An editorial title and an animated field of SVG ellipses. Change the copy and accent in the request, then render the same scene again.

8s · Silent

Requirements

Requires: Slopcamera 3.2.8 or later, Bun, a local browser and FFmpeg. No model account.

slopcamera html render --input examples/showcase/html/editorial.json --json

The result includes output.path for H.264 video, source.path for the retained request, receipt.path, and projectId. Rendering also retains a lossless RGB intermediate and the exact HTML/assets. Each invocation creates its own result; keep the receipt with the source revision you reviewed.

Inspect the output at its intended display size. Check text legibility, edges, first and last frames, motion continuity, and any source-specific details such as shader output or character articulation. A successful receipt records execution; your review decides whether the graphic is useful.

Revise the same composition

HTML timeline

Revise the same composition

The original editorial source with new copy and a warm accent. A second request preserves the layout and timing.

8s · Silent

Requirements

Requires: Slopcamera 3.2.8 or later, a supported local browser and FFmpeg. No model account.

To revise copy, palette, or timing, change parameters supported by the document or edit the HTML, then render a new request. editorial-revised.json changes copy and accent while retaining the original source. Keep the selected result's projectId for editing and delivery.

Add music or an overlay

For the island source, create its original procedural soundtrack before rendering:

python3 examples/showcase/html/synth-island.py
slopcamera html render --input examples/showcase/html/island-pulse.json --json

This needs Python 3. Its eight-second, four-bar phrase uses a declared 120 BPM clock. The scene retains the soundtrack separately from the rendered visuals. Declared beat timing and audio-reactive band envelopes are different inputs; Make a music video explains how to use either with your own local track.

For a transparent lower third, use the lower-third HTML through the SDK's workflow.media.htmlOverlay in an existing project. The page leaves its background transparent, but the supplied scene request sets a colored preview plate. Its H.264 output does not carry alpha. Inspect the final composite over the destination footage; use Run or recover a workflow for workflow execution and SDK surfaces for the local import boundary.

Animate type with Motion

Motion timeline

Make every frame count

Typography enters, holds and exits on an authored timeline.

8s · Silent

Requirements

Requires: Slopcamera 3.2.8 or later, a supported local browser and FFmpeg. No model account.

Use a seeked timeline for reveals, holds and exits. Edit the text or the timing in kinetic-title.html, then render kinetic-title.json. The long hold keeps the title readable before its exit.

Draw procedural contours

p5 canvas

Order, with a little drift

Seventy-two procedural contours redraw from absolute time in a p5 Canvas composition.

8s · Silent

Requirements

Requires: Slopcamera 3.2.8 or later, a supported local browser and FFmpeg. No model account.

Use p5 when each frame is a fresh drawing. The source redraws 72 contours from the requested time; changing the contour count or deformation changes the composition without storing a separate frame history.

Choreograph vector shapes

Two.js vectors

Many parts. One rhythm.

Sixty retained vector circles follow five editable orbits, with every position derived from the requested frame.

8s · Silent

Requirements

Requires: Slopcamera 3.2.8 or later, a supported local browser and FFmpeg. No model account.

Use Two.js when persistent vector objects make the scene easier to revise. Sixty circles follow five orbits. Change their radii, color or phase in the source, while keeping the supplied absolute-time callback.

Shape a shader background

Paper shaders

Living colour

A time-controlled Paper Shaders field adds grain and moving color beneath editable typography.

8s · Silent

Requirements

Requires: Slopcamera 3.2.8 or later, a supported local browser and FFmpeg. No model account.

Use Paper Shaders for a procedural color and grain treatment behind type. The supplied source controls shader time directly. Keep text contrast readable throughout the moving field when changing its palette.

Write a WGSL field

WGSL shader

Patterns from a program

One authored WGSL pass renders a living interference field.

8s · Silent

Requirements

Requires: Slopcamera 3.2.8 or later, a supported local browser and FFmpeg. No model account.

Use vgpu for a custom GPU pass with explicit shader resources. The example draws two moving interference sources beneath a grid and title. It produces ordinary video frames; it does not share live GPU textures with another profile.

Compose a transparent lower third

Transparent overlay

A title over your footage

A timed HTML/SVG lower third with editable copy. This H.264 preview uses an opaque plate; the source supports a separate transparent overlay.

6s · Silent

Requirements

Requires: Slopcamera 3.2.8 or later, a supported local browser and FFmpeg. No model account.

The title enters, holds and leaves over a colored preview plate. To use the source's transparent background, render it through workflow.media.htmlOverlay and inspect the returned overlay over your destination footage. The published MP4 demonstrates the opaque preview; it does not demonstrate alpha delivery.

Make a product launch film

For a film that walks through a product, start from the launch-film template instead of a blank scene:

slopcamera html init video --template launch-film --aspect 16:9
cd video && bun install && bun run build
slopcamera html still --input out/scene.json --at 3,12.5 --output out/stills
slopcamera html render --input out/scene.json --json > out/export.json
slopcamera html deliver out/export.json --basename launch --poster-at 9 --social-at 9 --cuts 1:1,9:16 --per-beat-clips

The template has six acts: cold open, title, a product walk with a browser frame, camera, cursor and drawn highlight, proof, limits and an end card. Replace its placeholder mockups with your product's own components; React renders them to static markup at build time and the film itself stays plain HTML, CSS and JavaScript. The motion helpers in @hraness/slopcamera/local/html-film are pure functions of time, and the same timeline writes WebVTT captions and a beats file with one caption per act.

html still and html preview draw frames with the same runtime as html render, so review them before a full render. html deliver reads the render's JSON result and writes a faststart MP4, a VP9 WebM, a poster, a 1200x630 social still, the requested aspect cuts and one 6 to 10 second clip per act, with a receipt. It exits non-zero when an MP4 is over 12 MB, the WebM over 10 MB or a JPEG over 250 KB. The launch films skill reference explains each act, the review loop and how HyperFrames or Remotion ideas map onto the helpers.

Resolve a failed render

Read the reported stage and keep its retained source and error evidence. A missing runtime needs the matching doctor fix; an undeclared resource needs a corrected request. If the lossless intermediate reaches the media-size bound, reduce resolution, frame rate, or duration. A dry run alone does not qualify a browser or GPU profile. Preserve the failing request before trying a reduced reproduction.