Skip to main content

Crate motionloom

Crate motionloom 

Source
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

  • api is the recommended stable integration surface.
  • prelude contains a small convenience import set.
  • experimental exposes 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§

ActionBoneNode
ActionNode
ActionPoseNode
ApplyActionNode
BackgroundNode
BrushDef
BufferNode
CameraNode
CharacterDesignGpuViewport
CharacterDesignViewportFrame
CharacterNode
CircleNode
ClipZoomSpec
ColorRgba
ComponentNode
DefsNode
DmabufPlane
One plane of a Linux DMA-BUF descriptor.
EffectNode
FaceJawNode
FilterDef
FilterStepDef
FontDef
FrameContext
FrameContext carries the minimum timeline state needed for effect evaluation.
GlbMeshData
GlbMetadata
GlbNodeData
GpuCompatibilityIssue
GpuCompatibilityReport
GradientStop
GraphParseError
GraphScript
GroupNode
ImageNode
InputNode
LayerColorBlurEffects
LayerEffectClip
LayerNode
LineNode
LinearGradientDef
LocalMaskLayer
MaskNode
MemoryAssetResolver
In-memory resolver keyed by the src string used in the MotionLoom script. Useful for WASM hosts that preload assets.
ModelProfileBoneAxisMapNode
ModelProfileBoneAxisNode
ModelProfileNode
ModelProfileRetargetMapNode
ModelProfileRetargetNode
OutputNode
PaletteColorDef
PaletteNode
PartNode
PassNode
PassParam
PathAssetResolver
Native filesystem resolver. Searches configured scene asset roots and falls back to treating src as an absolute or relative path.
PathNode
PerClipColorBlurEffects
PixelGridNode
PolylineNode
PrecomposeNode
PresentNode
ProcessCpuRenderer
ProcessEffectDefinition
RadialGradientDef
RectNode
RepeatNode
RootGraphShell
RuntimeCompileError
RuntimeFrameOutput
RuntimeProcessEffectInstance
RuntimeProgram
SampleConfig
ScalarKeyframe
SceneChainNode
SceneGpuTexture
GPU-native output of a scene frame render.
SceneLayerNode
ScenePreviewSurfaceOptions
Options for high-level preview surface rendering.
SceneRenderProgress
SceneRenderer
SceneRootNode
SceneSequenceNode
SceneTimelineNode
SceneTrackNode
ShadowNode
SkeletonBoneNode
SkeletonNode
SvgNode
TexNode
TextAnimatorNode
TextGlowEffectNode
TextLayoutNode
TextNode
TextStyle
TextStyleOverrideNode
TextTransformNode
UseNode
VideoFrame
Platform-neutral description of one rendered frame for export.
WorldAction
WorldActionBone
WorldActionPose
WorldActor
WorldApplyAction
WorldBackground
WorldBoneAxis
WorldBoneAxisMap
WorldCamera
WorldFrameRenderer
WorldGpuDiagnostics
WorldGraph
WorldMaterial
WorldModelProfile
WorldNode
WorldPlay
WorldPresent
WorldProfileRetarget
WorldRenderProgress
WorldRetarget
WorldRetargetMap
WorldSpritePlayback
WorldTime
ZoomStyle

Enums§

AlphaMode
AnimF32
AssetSource
Platform-neutral source for a media or model asset.
BlendMode
BlurSharpenMode
BufferElemType
BufferUsage
ColorSpace
EncodeError
Errors that can occur while encoding a video.
GlbLoadError
GpuCompatibilitySeverity
GpuCompatibilityTarget
GradientDef
GraphApplyScope
InputType
LoadOp
MotionLoomDocument
MotionLoomError
MotionLoomProcessError
MotionLoomRenderProgress
MotionLoomSceneRenderError
MotionLoomWorldError
OutputTarget
PassCache
PassKind
PassRole
PassTransitionClips
PassTransitionEasing
PassTransitionFallback
PassTransitionMode
PresentTarget
ProcessCategory
ProcessCpuRenderError
Quality
ResourceRef
RootGraphDomain
RuntimeProcessParamValue
SampleAddress
SampleFilter
SceneNode
ScenePlatformPreviewSurface
Platform-specific display surface for zero-copy preview bridges.
ScenePreviewBackend
Preferred preview backend for render_frame_to_preview_surface.
ScenePreviewPath
Preview surface path that ScenePreviewBackend::Auto is expected to take on the current platform for a compatible scene graph.
ScenePreviewPixelFormat
Pixel formats used by preview surfaces exposed to host applications.
ScenePreviewSurface
High-level preview output for apps that want the fastest available path.
SceneRenderProfile
SlideDirection
StoreOp
TexUsage
TextAlignMode
TextEffectNode
TextOverflowMode
TextSelectorKind
TextWrapMode
TextureFormat
VideoEffect
WorldBackgroundFit
WorldCameraControl
WorldCameraProjection
WorldMaterialStyle
WorldPathStyle
WorldRenderError

Constants§

MAX_LOCAL_MASK_LAYERS
PROCESS_CATEGORIES
PROCESS_EFFECTS

Traits§

AssetResolver
Resolves an asset identifier such as <Image src="..."> into an AssetSource. Implementations are provided for filesystem paths (native) and in-memory maps (WASM).
VideoEncoder
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.

Type Aliases§

ProcessError
ProcessGraph
ProcessGraphError
ProcessParseError
ProcessRuntimeError
RootGraphError
SceneRenderError
WorldAssetError
WorldCameraMode
WorldError
WorldParseError