Expand description
MotionLoom is a Rust parser and renderer for MotionLoom graph DSL.
It supports scene graphs, process/effect graphs, live preview surfaces, PNG sequence export, and video export through a caller-provided FFmpeg binary.
Most integrations should import from api or prelude instead of
depending on MotionLoom’s internal AST layout. The crate root keeps broader
re-exports for short-term compatibility with existing applications.
§Quick start: render one frame
use motionloom::api::{SceneRenderProfile, parse_graph_script, render_scene_graph_frame};
let script = r##"
<Graph fps={30} duration="1s" size={[640,360]}>
<Background color="#101827" />
<Scene id="example">
<Circle x="320" y="180" radius="96" color="#4CC9F0" />
<Text x="320" y="306" value="MotionLoom" fontSize="34" color="#FFFFFF" />
</Scene>
<Present from="example" />
</Graph>
"##;
let graph = parse_graph_script(script)?;
let frame = render_scene_graph_frame(&graph, 0, SceneRenderProfile::Gpu).await?;
frame.save("frame.png")?;§API stability
apiis the recommended stable integration surface.preludecontains a small convenience import set.experimentalexposes advanced editor, world, GLB, and timeline helpers that are useful but may change before the main API.
§Export paths
Use PNG sequence export when FFmpeg is not available. Use video export when the host application supplies an FFmpeg binary path.
use std::path::Path;
use motionloom::api::{
parse_graph_script, render_scene_graph_to_png_sequence_with_progress,
};
let graph = parse_graph_script(script)?;
render_scene_graph_to_png_sequence_with_progress(
&graph,
Path::new("frames"),
30,
|progress| eprintln!("{}/{}", progress.rendered_frames, progress.total_frames),
).await?;Modules§
- api
- Recommended MotionLoom public API surface.
- experimental
- Experimental and advanced MotionLoom APIs.
- prelude
- Convenience prelude for common MotionLoom integrations.
Structs§
- Action
Bone Node - Action
Node - Action
Pose Node - Apply
Action Node - Background
Node - Brush
Def - Buffer
Node - Camera
Node - Character
Design GpuViewport - Character
Design Viewport Frame - Character
Node - Circle
Node - Clip
Zoom Spec - Color
Rgba - Component
Node - Defs
Node - Dmabuf
Plane - One plane of a Linux DMA-BUF descriptor.
- Effect
Node - Face
JawNode - Filter
Def - Filter
Step Def - FontDef
- Frame
Context - FrameContext carries the minimum timeline state needed for effect evaluation.
- GlbMesh
Data - GlbMetadata
- GlbNode
Data - GpuCompatibility
Issue - GpuCompatibility
Report - Gradient
Stop - Graph
Parse Error - Graph
Script - Group
Node - Image
Node - Input
Node - Layer
Color Blur Effects - Layer
Effect Clip - Layer
Node - Line
Node - Linear
Gradient Def - Local
Mask Layer - Mask
Node - Memory
Asset Resolver - In-memory resolver keyed by the
srcstring used in the MotionLoom script. Useful for WASM hosts that preload assets. - Model
Profile Bone Axis MapNode - Model
Profile Bone Axis Node - Model
Profile Node - Model
Profile Retarget MapNode - Model
Profile Retarget Node - Output
Node - Palette
Color Def - Palette
Node - Part
Node - Pass
Node - Pass
Param - Path
Asset Resolver - Native filesystem resolver. Searches configured scene asset roots and
falls back to treating
srcas an absolute or relative path. - Path
Node - PerClip
Color Blur Effects - Pixel
Grid Node - Polyline
Node - Precompose
Node - Present
Node - Process
CpuRenderer - Process
Effect Definition - Radial
Gradient Def - Rect
Node - Repeat
Node - Root
Graph Shell - Runtime
Compile Error - Runtime
Frame Output - Runtime
Process Effect Instance - Runtime
Program - Sample
Config - Scalar
Keyframe - Scene
Chain Node - Scene
GpuTexture - GPU-native output of a scene frame render.
- Scene
Layer Node - Scene
Preview Surface Options - Options for high-level preview surface rendering.
- Scene
Render Progress - Scene
Renderer - Scene
Root Node - Scene
Sequence Node - Scene
Timeline Node - Scene
Track Node - Shadow
Node - Skeleton
Bone Node - Skeleton
Node - SvgNode
- TexNode
- Text
Animator Node - Text
Glow Effect Node - Text
Layout Node - Text
Node - Text
Style - Text
Style Override Node - Text
Transform Node - UseNode
- Video
Frame - Platform-neutral description of one rendered frame for export.
- World
Action - World
Action Bone - World
Action Pose - World
Actor - World
Apply Action - World
Background - World
Bone Axis - World
Bone Axis Map - World
Camera - World
Frame Renderer - World
GpuDiagnostics - World
Graph - World
Material - World
Model Profile - World
Node - World
Play - World
Present - World
Profile Retarget - World
Render Progress - World
Retarget - World
Retarget Map - World
Sprite Playback - World
Time - Zoom
Style
Enums§
- Alpha
Mode - AnimF32
- Asset
Source - Platform-neutral source for a media or model asset.
- Blend
Mode - Blur
Sharpen Mode - Buffer
Elem Type - Buffer
Usage - Color
Space - Encode
Error - Errors that can occur while encoding a video.
- GlbLoad
Error - GpuCompatibility
Severity - GpuCompatibility
Target - Gradient
Def - Graph
Apply Scope - Input
Type - LoadOp
- Motion
Loom Document - Motion
Loom Error - Motion
Loom Process Error - Motion
Loom Render Progress - Motion
Loom Scene Render Error - Motion
Loom World Error - Output
Target - Pass
Cache - Pass
Kind - Pass
Role - Pass
Transition Clips - Pass
Transition Easing - Pass
Transition Fallback - Pass
Transition Mode - Present
Target - Process
Category - Process
CpuRender Error - Quality
- Resource
Ref - Root
Graph Domain - Runtime
Process Param Value - Sample
Address - Sample
Filter - Scene
Node - Scene
Platform Preview Surface - Platform-specific display surface for zero-copy preview bridges.
- Scene
Preview Backend - Preferred preview backend for
render_frame_to_preview_surface. - Scene
Preview Path - Preview surface path that
ScenePreviewBackend::Autois expected to take on the current platform for a compatible scene graph. - Scene
Preview Pixel Format - Pixel formats used by preview surfaces exposed to host applications.
- Scene
Preview Surface - High-level preview output for apps that want the fastest available path.
- Scene
Render Profile - Slide
Direction - StoreOp
- TexUsage
- Text
Align Mode - Text
Effect Node - Text
Overflow Mode - Text
Selector Kind - Text
Wrap Mode - Texture
Format - Video
Effect - World
Background Fit - World
Camera Control - World
Camera Projection - World
Material Style - World
Path Style - World
Render Error
Constants§
Traits§
- Asset
Resolver - Resolves an asset identifier such as
<Image src="...">into anAssetSource. Implementations are provided for filesystem paths (native) and in-memory maps (WASM). - Video
Encoder - Platform-neutral video encoder boundary.
Functions§
- clear_
scene_ asset_ roots - Clear project-specific scene asset roots and return to built-in fallbacks.
- combine_
clip_ with_ layer - compile_
runtime_ program - create_
encoder - Convenience constructor that picks the correct platform encoder.
- default_
kernel_ for_ effect - diagnose_
world_ glb_ gpu_ plan - diagnose_
world_ graph_ actor_ gpu_ frame - eval_
time_ expr - inspect_
gpu_ compatibility - inspect_
root_ graph - is_
graph_ script - is_
known_ process_ kernel - is_
process_ graph_ script - is_
world_ graph_ script - kernel_
source_ by_ name - lerp
- Lerp is the base interpolation primitive used by keyframe curves.
- load_
glb_ mesh_ data - load_
glb_ metadata - next_
scene_ output_ path - next_
scene_ output_ path_ for_ profile - parse_
glb_ mesh_ data - parse_
glb_ metadata - parse_
graph_ script - parse_
motionloom_ document - parse_
process_ graph_ script - parse_
world_ graph_ script - process_
effect_ for_ id - process_
effects - process_
effects_ for_ category - render_
motionloom_ document_ to_ png_ sequence_ with_ progress - render_
motionloom_ document_ to_ png_ sequence_ with_ progress_ and_ cancel - render_
motionloom_ document_ to_ video_ with_ progress - render_
motionloom_ document_ to_ video_ with_ progress_ and_ cancel - render_
process_ frame_ cpu - render_
scene_ graph_ frame - render_
scene_ graph_ frame_ with_ resolver - Render a scene frame using a caller-provided asset resolver.
- render_
scene_ graph_ to_ png_ sequence_ with_ progress - render_
scene_ graph_ to_ png_ sequence_ with_ progress_ and_ cancel - render_
scene_ graph_ to_ video - render_
scene_ graph_ to_ video_ with_ progress - render_
scene_ graph_ to_ video_ with_ progress_ and_ cancel - render_
world_ frame - render_
world_ graph_ to_ png_ sequence_ with_ progress - render_
world_ graph_ to_ png_ sequence_ with_ progress_ and_ cancel - render_
world_ graph_ to_ video_ with_ progress - resolve_
pass_ kernel - sample_
anim_ f32 - sample_
linear_ segment - Sample a simple linear segment between two keyed values in milliseconds.
- set_
scene_ asset_ roots - Set project-specific asset roots used by scene
<Image>and<Svg>nodes.