Refactored JSX elements from lowercase to PascalCase, including `<scene>` to `<Scene>`, `<text>` to `<Text>`, and others, to improve consistency and clarity in the codebase. Updated related documentation to reflect these changes, ensuring that the usage of JSX elements aligns with the new naming conventions. This update enhances the overall readability and usability of the JSX API.
2.7 KiB
2.7 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"
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.