Added width and height properties to various video and text elements across examples and documentation files to ensure consistent sizing. This change enhances the clarity of the examples and improves the user experience by providing explicit dimensions for media elements.
2.8 KiB
2.8 KiB
Animations
animations declares preset in/out animations on a clip: each entry plays over the clip's head ("in") or tail ("out"), between the node's static state and the preset's start/end state. For hand-authored motion on individual props, use keyframes; the two compose on distinct properties.
<video
src="/Movies/intro.mp4"
width={1920} height={1080}
start={0} end={8}
animations={[
{ type: "fade", duration: "15f" },
{ type: "slideUp", phase: "out", duration: 0.5, delay: 0.2 },
]}
/>
type AnimationSpec = {
type: AnimationType; // preset, see below
phase?: "in" | "out"; // default "in"
duration?: Time; // default 1 second
delay?: Time; // gap between the clip edge and the animation; default 0
};
Types
The editor's animations inspector options:
type |
Effect |
|---|---|
"fade" |
Opacity ramp. |
"slideLeft", "slideRight", "slideUp", "slideDown" |
Slide in from (or out toward) the named direction, fading. |
"grow" |
Scales up from 50%. |
"shrink" |
Scales down from 150%. |
"spin" |
Scale plus rotation. |
"twist" |
Overscale plus rotation and offset. |
"blur" |
24px blur ramp. |
"appearWord" |
Text only: reveals the text word by word. |
"appearChar" |
Text only: reveals the text character by character. |
"scramble" |
Text only: resolves scrambled characters into the text. |
"gain" |
Audio only: volume ramp (fade-in/fade-out of the mix). No visual effect. |
Text types apply only to <text> and <captions>; a mount that puts them elsewhere fails validation.
Semantics
durationanddelaytake any time format. An"in"animation plays over[delay, delay + duration]from the clip's in point; an"out"animation endsdelaybefore the clip's out point. Both track the clip when it is retimed.- A node takes any number of animations; overlapping entries apply in list order, later ones writing over earlier ones on the properties they share. A keyframe track on the same property (say, keyframed
opacitynext to"fade") overrides the preset while it has effect; presets and keyframes on distinct properties compose freely. - The list is mount-shaped: setting
animationsreplaces the node's existing animations,[]removes them all, and an omitted prop leaves hand-added ones untouched. - Animations land as regular editor animations, editable in the inspector. Part of the shared property table:
dapi node patchacceptsanimationswith identical semantics, e.g.--json '[{ "id": 42, "animations": [{ "type": "fade" }] }]', and they list underanimationsindapi node tree.