Skip to content
中文

Motion, transitions, and speed

Paste each complete script into execute’s script. Each creates its own track; text, colors, and shapes need no media assets.

Keyframes and text reveal

Animate x, y, scale, rotation, opacity, and blur. Keyframe at is seconds from clip start; times must remain ordered and distinct after frame snapping. Animation overrides static transforms. Positions are normalized canvas coordinates, with 0.5 at center. Easing belongs to the destination keyframe: linear, in, out, inOut, bezier, or spring.

const track = AddTrack("video", { name: "Text reveal" });
Insert(track, {
type: "text", text: "Hello Cut", start: 0, length: 4,
reveal: { by: "char", delay: 0.2, stagger: 0.08, duration: 0.4,
from: { y: 0.5, opacity: 0 }, ease: "out" }
});

by also accepts word or line. Each unit starts at delay + index * stagger and takes duration seconds. from.y is relative to font size, not canvas height.

const track = AddTrack("video", { name: "Flying title" });
Insert(track, {
type: "text", text: "A new perspective", start: 0, length: 4,
style: { font: { size: 72, weight: 700 }, align: { vertical: "bottom" }, margin: 0.1 },
animate: {
x: [{ at: 0, value: 0.1 }, { at: 1, value: 0.5,
ease: { spring: { stiffness: 100, damping: 14, mass: 1 } } }],
opacity: [{ at: 0, value: 0 }, { at: 0.5, value: 1, ease: "out" }]
}
});

Animation presets

Call ListAnimations() first to discover the catalog. Each entry returns id, version, phase (in/out/loop), target (any/text), name, description, defaultDuration (seconds), and params (parameter name, type, default/range/enum values, and description as applicable). Each slot use is { preset, duration?, ...params }; for example, duration is in seconds.

Insert accepts animation: { in?, out?, loop? }, and Update accepts the same object. Set animation: null to clear the preset and its generated animate/reveal. Each of the three slots accepts at most one preset. Applying a preset replaces the clip’s existing animate and reveal. When clip length or transform changes, the preset is expanded again automatically: if the clip gets shorter, in/out durations shrink proportionally; when it grows, the requested durations return. After Split, the left clip keeps in, the right keeps out, and both keep loop.

in and out define entrance and exit; loop runs only between them. If slots animate the same property, loop occupies only that middle interval. text targets are text entrances only; their duration controls the reveal rhythm per character/word/line, not the total time for all text. Out and loop presets apply to the whole clip, not per character/word/line.

Writing animate or reveal directly detaches the preset. Supplying animation together with either field in one Insert/Update call is an error. Each property is limited to 600 keyframes; a loop period must be at least 4 frames. Error codes: UNKNOWN_ANIMATION (unknown preset), INVALID_ANIMATION_PARAM (invalid slot/parameter or keyframe limit), ANIMATION_TOO_LONG (in+out exceed clip length), ANIMATION_TARGET_MISMATCH (wrong target or non-visual clip), ANIMATION_PHASE_MISMATCH (preset used in the wrong slot).

This example needs no media assets and can be run directly:

Print(ListAnimations());
const track = AddTrack("video", { name: "Preset motion" });
const id = Insert(track, { type: "text", text: "Hello Cut", start: 0, length: 4,
animation: { in: { preset: "typewriter", duration: 0.6 }, out: { preset: "fade_out" }, loop: { preset: "pulse" } }
});
Update(id, { length: 5 }); // preset effects are regenerated from their source

Join neighboring shots

Call ListTransitions() for effect IDs, defaults, and parameter ranges. Join requires butt-adjacent clips on the same visual track; audio and captions are rejected. Its default overlap is 0.5 seconds, positive and shorter than both clips.

Print(ListTransitions());
const track = AddTrack("video", { name: "Joined shots" });
const left = Insert(track, { type: "color", color: "#172554", start: 0, length: 4 });
const right = Insert(track, { type: "color", color: "#7C3AED", start: 4, length: 4 });
const join = Join(left, right, { effect: { kind: "dissolve" } });
Print(GetTimeline().duration); // 7.5 seconds
UpdateJoin(join, { length: 0.8, effect: { kind: "push", direction: "left" } });
Print(GetTimeline().duration, GetTimeline().joins); // 7.2 seconds
Preview([GetItem(right).start + 0.4]);

The first join produces 7.5 seconds; the update produces 7.2 seconds. The right clip and same-track followers move left. Other tracks stay put: recheck captions and music. Each clip allows one incoming and one outgoing join, with summed lengths no greater than clip length. DeleteJoin restores the butt cut and shifts followers back. Per-clip transitionIn and transitionOut are separate entrance/exit effects.

Speed and reverse

Video/audio playback accepts {kind: "rate", rate, direction, audio}, with rate 0.25–4, direction forward or reverse, and audio preservePitch, resample, or mute. Omission means 1× forward with preserved pitch. Reverse requires explicit audio: "mute". {kind: "freeze"} holds sourceIn silently.

Updating playback preserves output length by default. SetSpeed requires keep: duration preserves output length; source preserves consumed source and changes length. It returns actual length and sourceOut. Change a frozen clip back to rate with Update first. Length conflicts fail unless you explicitly use {keep: "source", ripple: true} to shift same-track followers.

const track = AddTrack("video", { name: "Speed" });
const id = Insert(track, {
type: "video", media: { libraryId: "<library_id>", assetId: "<video_asset_id>" },
start: 0, length: 4
});
Print(SetSpeed(id, 0.5, { keep: "source" })); // {length: 8, sourceOut: 4}
Print(SetSpeed(id, 2, { keep: "source" })); // {length: 2, sourceOut: 4}
Print(SetSpeed(id, 0.5, { keep: "duration" })); // {length: 2, sourceOut: 1}
Print(GetItem(id));
Preview([0, 1]);

Replace both media placeholders with a video at least four seconds long in a bound library. The browser preview, server Preview, frames and exports all support reverse. Speed-adjusted audio is generated asynchronously after the edit commits. Execute success does not mean audio is ready; exports wait for it.

Masks, effects, and LUTs

Visual clips accept shape masks (rectangles, ellipses, or SVG paths) and track masks that read another visual track’s alpha or luma. Track masks cannot self-reference or form cycles; at most two track mattes may be active per frame. Invalid definitions return INVALID_MASK, deleting a referenced track returns MASK_IN_USE, and exceeding the concurrent matte limit returns TOO_MANY_MASKS.

ListEffects() reports categories, parameter ranges, defaults, cost, and bounds; built-in lut entries are preset color lookup tables. Animated effect speed is measured in cycles per second. Effects increase CPU export time; user .cube LUT files are not supported yet.

Audio and loudness

Audio clip gain keyframes are relative gain in dB. Audio track role can be voice, music, or sfx. Ducking responds to audible clip occupancy on the under track and does not inspect waveform volume. exports.create accepts loudness: {target_lufs, true_peak_dbtp}; completed exports report the targets and measured integrated LUFS and true peak. Normalization adds analysis and rendering time.

Text catalogs and templates

Discover presets with ListTextStyles() and ListTextTemplates(). Set style.preset on text or a track; reads return styleSource. Inspect template slots before calling InsertTemplate(track, {template, start, slots}) to insert a layered composition. AlignCaptions(track, script) aligns existing captions to script text and returns replaced/added/deleted counts.

Next steps