@pixerate/editor 0.70.0 → 0.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +327 -74
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +104 -2
- package/dist/animation-editor/index.d.ts +104 -2
- package/dist/animation-editor/index.js +279 -26
- package/dist/animation-editor/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -56,6 +56,11 @@ interface MotionScene {
|
|
|
56
56
|
* node with a `play` command (a "pop and settle" or "attention" you use many times).
|
|
57
57
|
*/
|
|
58
58
|
clips?: Record<string, MotionClip>;
|
|
59
|
+
/**
|
|
60
|
+
* Properties that follow other properties: a background moving at half the speed of the
|
|
61
|
+
* foreground (parallax), a wheel turning as it rolls. Each adds to what its target's commands do.
|
|
62
|
+
*/
|
|
63
|
+
drivers?: MotionDriver[];
|
|
59
64
|
/** Parameters a Flair effect made from this scene exposes (see `toFlairVectorEffect`). */
|
|
60
65
|
controls?: MotionControl[];
|
|
61
66
|
/** Named sets of control values. */
|
|
@@ -331,6 +336,31 @@ interface MotionClip {
|
|
|
331
336
|
/** Commands, timed as in a shot; `"$"` in `targets` stands for the node played on. Clips cannot play clips. */
|
|
332
337
|
run: MotionCommand[];
|
|
333
338
|
}
|
|
339
|
+
/** Properties a driver reads and drives: offsets (document units), turn (degrees), scales and opacity. */
|
|
340
|
+
type MotionDrivenProperty = 'x' | 'y' | 'rotation' | 'scaleX' | 'scaleY' | 'opacity';
|
|
341
|
+
declare const MOTION_DRIVEN_PROPERTIES: readonly MotionDrivenProperty[];
|
|
342
|
+
/**
|
|
343
|
+
* One property following another. Both are read as a change from rest (offsets and turns from
|
|
344
|
+
* 0, scales and opacity from 1): the target's property changes by `source change · factor + offset`,
|
|
345
|
+
* clamped to `clamp`, on top of its own commands (added to offsets and turns, multiplied into
|
|
346
|
+
* scales and opacity as 1 + change).
|
|
347
|
+
*/
|
|
348
|
+
interface MotionDriver {
|
|
349
|
+
/** The node that follows. */
|
|
350
|
+
target: string;
|
|
351
|
+
property: MotionDrivenProperty;
|
|
352
|
+
/** The node and property it follows. */
|
|
353
|
+
source: {
|
|
354
|
+
node: string;
|
|
355
|
+
property: MotionDrivenProperty;
|
|
356
|
+
};
|
|
357
|
+
/** Default 1 (0.5 moves at half the speed; 360 / (2π·radius) turns a wheel by how far it rolls). */
|
|
358
|
+
factor?: number;
|
|
359
|
+
/** Added to the change (default 0). */
|
|
360
|
+
offset?: number;
|
|
361
|
+
/** Limits the change to `[min, max]`. */
|
|
362
|
+
clamp?: [number, number];
|
|
363
|
+
}
|
|
334
364
|
/** The placeholder target in a clip's commands. */
|
|
335
365
|
declare const MOTION_CLIP_TARGET = "$";
|
|
336
366
|
/** Plays a clip (`scene.clips`) on the targets: its commands, with `"$"` standing for each target. */
|
|
@@ -539,6 +569,10 @@ declare const MOTION_ISSUE_CODES: {
|
|
|
539
569
|
readonly severity: "warning";
|
|
540
570
|
readonly wording: "A wipe, iris or split cannot clip a node with no width or height (a lone straight line), so it fades instead.";
|
|
541
571
|
};
|
|
572
|
+
readonly 'driver-cycle': {
|
|
573
|
+
readonly severity: "error";
|
|
574
|
+
readonly wording: "Drivers follow each other in a loop, so none of them has a value.";
|
|
575
|
+
};
|
|
542
576
|
readonly 'unknown-clip': {
|
|
543
577
|
readonly severity: "error";
|
|
544
578
|
readonly wording: "A play command names a clip the scene does not have.";
|
|
@@ -682,6 +716,8 @@ declare class MotionSceneFormatError extends Error {
|
|
|
682
716
|
declare function commandShapeProblems(command: unknown, where: string): string[];
|
|
683
717
|
/** Problems with a scene's `clips`: names, and each clip's commands (which may target `"$"` but not play clips). */
|
|
684
718
|
declare function clipsShapeProblems(clips: unknown): string[];
|
|
719
|
+
/** Problems with a scene's `drivers`. */
|
|
720
|
+
declare function driversShapeProblems(drivers: unknown): string[];
|
|
685
721
|
/** Problems with one shot's shape. */
|
|
686
722
|
declare function shotShapeProblems(shot: unknown, where: string): string[];
|
|
687
723
|
/** Problems with a scene's shape (empty when well formed). */
|
|
@@ -782,6 +818,10 @@ interface MotionTimeline {
|
|
|
782
818
|
segments: MotionSegment[];
|
|
783
819
|
/** Segments per `node\u0000property`, in start order. */
|
|
784
820
|
tracks: ReadonlyMap<string, readonly MotionSegment[]>;
|
|
821
|
+
/** The scene's drivers (properties that follow other properties). */
|
|
822
|
+
drivers?: readonly MotionDriver[];
|
|
823
|
+
/** Rest opacity per node, for drivers that read opacity. */
|
|
824
|
+
restOpacity?: ReadonlyMap<string, number>;
|
|
785
825
|
}
|
|
786
826
|
/** Where a node sits in the artwork. */
|
|
787
827
|
interface MotionNodeEntry {
|
|
@@ -879,6 +919,20 @@ declare function motionBeatAt(grid: MotionBeatGrid, ms: number): {
|
|
|
879
919
|
};
|
|
880
920
|
/** The time a cue names, ms, or undefined when it names a beat with no grid or a word the narration lacks. */
|
|
881
921
|
declare function motionCueTime(scene: Pick<MotionScene, 'beat' | 'narration'>, cue: MotionCue): number | undefined;
|
|
922
|
+
/**
|
|
923
|
+
* A node property's value at `time` with its commands, additive layers and drivers: offsets and
|
|
924
|
+
* turns from 0, scales from 1, opacity from the node's own. `raw` ignores behaviours.
|
|
925
|
+
*/
|
|
926
|
+
declare function motionPropertyValue(timeline: MotionTimeline, node: string, property: MotionDrivenProperty, time: number, raw?: boolean, depth?: number): number;
|
|
927
|
+
/** `value` with the drivers of `node`'s `property` applied (a no-op without drivers). Chains of drivers are followed up to 8 deep; `check` reports cycles. */
|
|
928
|
+
declare function applyMotionDrivers(timeline: MotionTimeline, node: string, property: MotionDrivenProperty, value: number, time: number, raw?: boolean, depth?: number): number;
|
|
929
|
+
/** Nodes driven by a driver (directly). */
|
|
930
|
+
declare function motionDrivenNodes(timeline: MotionTimeline): Set<string>;
|
|
931
|
+
/**
|
|
932
|
+
* The segments a node's drivers depend on (its sources', followed down chains), for exporters that
|
|
933
|
+
* must sample a driven property wherever its sources change.
|
|
934
|
+
*/
|
|
935
|
+
declare function motionDriverSources(timeline: MotionTimeline, node: string, properties: readonly MotionDrivenProperty[], seen?: Set<string>): MotionSegment[];
|
|
882
936
|
/** How many times a command plays (1 for `enter`, `exit` and `wait`, which do not repeat). */
|
|
883
937
|
declare function motionCommandRepeat(command: MotionCommand): number;
|
|
884
938
|
/** How long one target of a command takes (ms), every repeat included. */
|
|
@@ -1100,6 +1154,17 @@ interface MotionOverlayOptions {
|
|
|
1100
1154
|
* `motionFrameToSvg`.
|
|
1101
1155
|
*/
|
|
1102
1156
|
declare function motionStageSvg(scene: MotionScene, time: number, options?: MotionSvgOptions & MotionOverlayOptions): string;
|
|
1157
|
+
interface MotionContactSheetOptions extends MotionSvgOptions, MotionOverlayOptions {
|
|
1158
|
+
/** Frames a row (default: about square). */
|
|
1159
|
+
columns?: number;
|
|
1160
|
+
/** Write each frame's time (and shot) under it (default true). */
|
|
1161
|
+
labels?: boolean;
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Several moments of the scene in one SVG, in a grid with each frame's time and shot under it:
|
|
1165
|
+
* a contact sheet, to see a whole animation (or an agent's change to it) at a glance.
|
|
1166
|
+
*/
|
|
1167
|
+
declare function motionContactSheetSvg(scene: MotionScene, times: readonly number[], options?: MotionContactSheetOptions): string;
|
|
1103
1168
|
|
|
1104
1169
|
/** Changes shorter than this (ms) are too quick to follow. */
|
|
1105
1170
|
declare const MOTION_MIN_CHANGE_MS = 120;
|
|
@@ -1174,6 +1239,9 @@ type MotionEdit = {
|
|
|
1174
1239
|
op: 'set_clip';
|
|
1175
1240
|
name: string;
|
|
1176
1241
|
clip: MotionClip | null;
|
|
1242
|
+
} | {
|
|
1243
|
+
op: 'set_drivers';
|
|
1244
|
+
drivers: MotionDriver[];
|
|
1177
1245
|
} | {
|
|
1178
1246
|
op: 'replace_scene';
|
|
1179
1247
|
scene: MotionScene;
|
|
@@ -1195,6 +1263,32 @@ type MotionEditResult = {
|
|
|
1195
1263
|
declare function freshShotId(scene: MotionScene, base?: string): string;
|
|
1196
1264
|
/** Applies edits in order, as one change. Fails without changing anything when one fails. */
|
|
1197
1265
|
declare function applyMotionEdits(scene: MotionScene, edits: MotionEdit | readonly MotionEdit[]): MotionEditResult;
|
|
1266
|
+
/** What one edit made, for later edits in a batch to refer to (`"$0.indexes[0]"`). */
|
|
1267
|
+
interface MotionEditOutcome {
|
|
1268
|
+
op: string;
|
|
1269
|
+
/** The shot it changed or added to. */
|
|
1270
|
+
shot?: string;
|
|
1271
|
+
/** Shots it added. */
|
|
1272
|
+
shots?: string[];
|
|
1273
|
+
/** Indexes of the commands it added (or where it moved one). */
|
|
1274
|
+
indexes?: number[];
|
|
1275
|
+
/** The clip it set. */
|
|
1276
|
+
clip?: string;
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Resolves references to earlier edits' outcomes in a batch: a string `"$N.path"` (`$last` for the
|
|
1280
|
+
* one before) is replaced by that value, e.g. `"$0.indexes[0]"` for the index of the first command
|
|
1281
|
+
* edit 0 added; `"$$..."` is a literal `$`. Returns the resolved edits with what each made, or why
|
|
1282
|
+
* a reference does not resolve. Nothing is applied.
|
|
1283
|
+
*/
|
|
1284
|
+
declare function resolveMotionEditRefs(scene: MotionScene, edits: readonly MotionEdit[]): {
|
|
1285
|
+
ok: true;
|
|
1286
|
+
edits: MotionEdit[];
|
|
1287
|
+
outcomes: MotionEditOutcome[];
|
|
1288
|
+
} | {
|
|
1289
|
+
ok: false;
|
|
1290
|
+
error: string;
|
|
1291
|
+
};
|
|
1198
1292
|
/** An empty scene over `artwork`. */
|
|
1199
1293
|
declare function createMotionScene(artwork: VectorDocument, init?: Partial<Omit<MotionScene, 'artwork' | 'version'>>): MotionScene;
|
|
1200
1294
|
|
|
@@ -2109,7 +2203,7 @@ declare function createAnimationEditorToolProvider(controller: AnimationEditorCo
|
|
|
2109
2203
|
* A short authoring guide for a model writing vector animations with the animation editor's
|
|
2110
2204
|
* tools. Static, so it caches well as part of a system prompt.
|
|
2111
2205
|
*/
|
|
2112
|
-
declare const ANIMATION_EDITOR_AGENT_INSTRUCTIONS = "You animate vector artwork. A scene is artwork (vector paths and groups, each with an id) plus shots.\n\nHow it plays\n- Shots play in order. A shot optionally moves the camera, plays its commands, then holds (default 600 ms).\n- Commands in a shot play one after another; give \"with\": \"previous\" to start one together with the command before, \"delay\" to wait, \"stagger\" to offset several targets.\n- Timing comes from the content: each command has a default length (enter 600 ms, move 700 ms, draw follows the path length). Only set \"duration\" to change the pace.\n- Anything that enters later is hidden until it enters. Things that never enter are visible from the start.\n- Every frame is a pure function of time: the same scene always plays the same frames.\n\nCommands\n- enter (fade, pop, grow, slide, draw) and exit (fade, shrink, slide, undraw) bring things in and out.\n- enter also reveals through a clip over the target's box: wipe (behind an edge travelling \"direction\", default right), iris (from the centre; \"shape\": circle or box) and split (from a line through the middle; \"orientation\": horizontal or vertical). exit wipe hides the same way. Reveals need a width and a height: use draw / undraw for a straight line.\n- draw draws strokes on to a fraction; move, rotate, scale and fade change the pose (about the centre); style blends solid colours and stroke width.\n- Drawing a group of strokes: \"order\": \"sequence\" draws them one after another (a signature, a diagram), \"sortBy\": \"distance\" from \"origin\" reveals outward, \"pace\": \"speed\" keeps one speed; draw with \"comet\": 0.2 sends a short stroke along a path and off the end.\n- Reuse motion: set_animation_clip defines a clip (commands targeting \"$\"), and { \"type\": \"play\", \"clip\": name, \"targets\": [...] } plays it on any nodes (with stagger and speed). copy_animation gives other nodes one node's motion.\n- move takes \"via\" waypoints for a curved, smooth path that passes exactly through each point (steady speed by default); use it instead of chaining moves, which stop at each point.\n- enter also has zoom (settles from larger) and rise (rises a short way, overshooting a touch); pop and zoom take a starting \"scale\".\n- morph turns a shape into another node's shape (keep the target hidden); match does the same for a whole group, part by part (Smart Animate: draw the end state as a second, hidden group whose parts share names with the first); follow moves along a path node (with \"rotate\", moves made meanwhile turn with the path).\n- Emphasis draws the eye and returns to rest: pulse (swell), shake (side to side, or \"axis\": \"vertical\"), teeter (rock), wave (bob, no settling), wiggle (seeded wander; the same seed wanders the same way) and color-pulse (tint and back).\n- Emphasis stacks on other motion: a shake during a slide shakes as it slides. Give move, rotate or scale \"blend\": \"add\" to stack them too (what they add stays); \"blend\": \"replace\" makes a change take over instead.\n- Any command but enter and exit can \"repeat\" (loop, mirror back and forth, or offset to carry on: rotate by 90, repeat 4 is a full turn); \"duration\" is one cycle.\n- Springs (\"spring-gentle\", \"spring-quick\", \"spring-bouncy\", \"spring-slow\" or { \"type\": \"spring\", \u2026 }) feel physical; leave \"duration\" out and the spring sets it.\n- To time shots to music or a voiceover: set a \"beat\" grid or \"narration\" word timings with set_animation_settings, read them with get_timing_grid, and give a shot \"at\": { \"beat\": n } or { \"word\": i }. The shot before holds until the cue; check_animation warns when a cue is missed.\n- \"steps\": 12 (on a command, or for the whole scene with set_animation_settings) holds poses \"on twos\" for a hand-drawn look. \"geometric\": true on scale or a camera zooms at an even rate.\n- Commands share their names and defaults with Flair's motion primitives (get_animation shows each one's \"flairPrimitive\"), and emphasis, reveals and follows export to Flair exactly.\n- effect tweens a numeric parameter of a live path effect already on the node (twist angle, wiggle time, zig zag size).\n\nWorking method\n1. get_animation to learn the element ids (set_animation_artwork_svg first if there is no artwork: give every element you will animate an id; or import_flair_effect to start from a Flair effect and edit it).\n2. Plan a few shots, each one idea. Add them with insert_shots (add_commands, update_command, move_command and delete_commands refine a shot), or edit_animation to make several edits as one step (dry_run first when unsure).\n3. To hit a length, fit_animation (keep the shots whose pace matters). check_animation and fix every error and warning; render_animation_frame (shot + \"end\") to look at the result; add onion_skin or motion_paths to see the motion in one picture, or get_motion_path for the numbers.\n- For something the viewer plays (a button, a toggle, a step-by-step explainer), set \"trigger\" with set_animation_settings: click plays the next shot on each click and then starts over (make the last shot put things back for a toggle), hover or press plays and rewinds, scroll scrubs.\n4. To make a reusable Flair effect, set_animation_controls (colour controls stand for every use of their default colour) and export_flair_effect.\n\nKeep motion purposeful: one thing moving at a time reads best, ease-out for arrivals, ease-in for exits, and hold long enough to see each result.";
|
|
2206
|
+
declare const ANIMATION_EDITOR_AGENT_INSTRUCTIONS = "You animate vector artwork. A scene is artwork (vector paths and groups, each with an id) plus shots.\n\nHow it plays\n- Shots play in order. A shot optionally moves the camera, plays its commands, then holds (default 600 ms).\n- Commands in a shot play one after another; give \"with\": \"previous\" to start one together with the command before, \"delay\" to wait, \"stagger\" to offset several targets.\n- Timing comes from the content: each command has a default length (enter 600 ms, move 700 ms, draw follows the path length). Only set \"duration\" to change the pace.\n- Anything that enters later is hidden until it enters. Things that never enter are visible from the start.\n- Every frame is a pure function of time: the same scene always plays the same frames.\n\nCommands\n- enter (fade, pop, grow, slide, draw) and exit (fade, shrink, slide, undraw) bring things in and out.\n- enter also reveals through a clip over the target's box: wipe (behind an edge travelling \"direction\", default right), iris (from the centre; \"shape\": circle or box) and split (from a line through the middle; \"orientation\": horizontal or vertical). exit wipe hides the same way. Reveals need a width and a height: use draw / undraw for a straight line.\n- draw draws strokes on to a fraction; move, rotate, scale and fade change the pose (about the centre); style blends solid colours and stroke width.\n- Drawing a group of strokes: \"order\": \"sequence\" draws them one after another (a signature, a diagram), \"sortBy\": \"distance\" from \"origin\" reveals outward, \"pace\": \"speed\" keeps one speed; draw with \"comet\": 0.2 sends a short stroke along a path and off the end.\n- Tie properties together with set_animation_drivers: parallax layers, a wheel that turns as it rolls, a shadow that fades as something rises. Drivers add to the target's own commands.\n- Reuse motion: set_animation_clip defines a clip (commands targeting \"$\"), and { \"type\": \"play\", \"clip\": name, \"targets\": [...] } plays it on any nodes (with stagger and speed). copy_animation gives other nodes one node's motion.\n- move takes \"via\" waypoints for a curved, smooth path that passes exactly through each point (steady speed by default); use it instead of chaining moves, which stop at each point.\n- enter also has zoom (settles from larger) and rise (rises a short way, overshooting a touch); pop and zoom take a starting \"scale\".\n- morph turns a shape into another node's shape (keep the target hidden); match does the same for a whole group, part by part (Smart Animate: draw the end state as a second, hidden group whose parts share names with the first); follow moves along a path node (with \"rotate\", moves made meanwhile turn with the path).\n- Emphasis draws the eye and returns to rest: pulse (swell), shake (side to side, or \"axis\": \"vertical\"), teeter (rock), wave (bob, no settling), wiggle (seeded wander; the same seed wanders the same way) and color-pulse (tint and back).\n- Emphasis stacks on other motion: a shake during a slide shakes as it slides. Give move, rotate or scale \"blend\": \"add\" to stack them too (what they add stays); \"blend\": \"replace\" makes a change take over instead.\n- Any command but enter and exit can \"repeat\" (loop, mirror back and forth, or offset to carry on: rotate by 90, repeat 4 is a full turn); \"duration\" is one cycle.\n- Springs (\"spring-gentle\", \"spring-quick\", \"spring-bouncy\", \"spring-slow\" or { \"type\": \"spring\", \u2026 }) feel physical; leave \"duration\" out and the spring sets it.\n- To time shots to music or a voiceover: set a \"beat\" grid or \"narration\" word timings with set_animation_settings, read them with get_timing_grid, and give a shot \"at\": { \"beat\": n } or { \"word\": i }. The shot before holds until the cue; check_animation warns when a cue is missed.\n- \"steps\": 12 (on a command, or for the whole scene with set_animation_settings) holds poses \"on twos\" for a hand-drawn look. \"geometric\": true on scale or a camera zooms at an even rate.\n- Commands share their names and defaults with Flair's motion primitives (get_animation shows each one's \"flairPrimitive\"), and emphasis, reveals and follows export to Flair exactly.\n- effect tweens a numeric parameter of a live path effect already on the node (twist angle, wiggle time, zig zag size).\n\nWorking method\n1. get_animation to learn the element ids (set_animation_artwork_svg first if there is no artwork: give every element you will animate an id; or import_flair_effect to start from a Flair effect and edit it).\n2. Plan a few shots, each one idea. Add them with insert_shots (add_commands, update_command, move_command and delete_commands refine a shot), or edit_animation to make several edits as one step (dry_run first when unsure).\n- In edit_animation, a later op can use what an earlier one made: \"$0.indexes[0]\" (the first command op 1 added), \"$last.shot\".\n3. To hit a length, fit_animation (keep the shots whose pace matters). check_animation and fix every error and warning; render_animation_frame (shot + \"end\") to look at the result, or with \"times\" for a contact sheet of several moments; add onion_skin or motion_paths to see the motion in one picture, or get_motion_path for the numbers.\n- For something the viewer plays (a button, a toggle, a step-by-step explainer), set \"trigger\" with set_animation_settings: click plays the next shot on each click and then starts over (make the last shot put things back for a toggle), hover or press plays and rewinds, scroll scrubs.\n4. To make a reusable Flair effect, set_animation_controls (colour controls stand for every use of their default colour) and export_flair_effect.\n\nKeep motion purposeful: one thing moving at a time reads best, ease-out for arrivals, ease-in for exits, and hold long enough to see each result.";
|
|
2113
2207
|
|
|
2114
2208
|
/**
|
|
2115
2209
|
* Helpers for hand-editing UIs (React's and Svelte's command inspector, ease picker, cue picker,
|
|
@@ -2255,5 +2349,13 @@ declare function parseMotionNarration(text: string): {
|
|
|
2255
2349
|
} | {
|
|
2256
2350
|
error: string;
|
|
2257
2351
|
};
|
|
2352
|
+
/** Drivers as text, one a line: `dot.x <- box.x * 0.5 + 2 [-10, 10]` (factor, offset and clamp optional). */
|
|
2353
|
+
declare function formatMotionDrivers(drivers: readonly MotionDriver[] | undefined): string;
|
|
2354
|
+
/** Reads drivers typed one a line (see `formatMotionDrivers`); empty text clears them. */
|
|
2355
|
+
declare function parseMotionDrivers(text: string): {
|
|
2356
|
+
drivers: MotionDriver[];
|
|
2357
|
+
} | {
|
|
2358
|
+
error: string;
|
|
2359
|
+
};
|
|
2258
2360
|
|
|
2259
|
-
export { ANIMATION_EDITOR_AGENT_INSTRUCTIONS, AnimationEditorController, type AnimationEditorOptions, type AnimationEditorSelection, type AnimationEditorState, type AnimationEditorToolProviderOptions, FLAIR_EASES, FLAIR_EXPORT_VERSION, type FlairEase, type FlairEaseName, type FlairEffectDocument, type FlairEffectOptions, type FlairExportOptions, type FlairImportOptions, type FlairImportResult, type FlairMotionExport, type FlairSpringEase, type FlairSvgAnimation, type FlairSvgMotion, type FlairVectorEffect, type LottieAnimation, type LottieExport, type LottieExportOptions, type LottieKeyframe, type LottieShape, type LottieValue, MOTION_ADDITIVE_PROPERTIES, MOTION_BLENDS, MOTION_CAMERA_MS, MOTION_CLIP_TARGET, MOTION_COMMAND_SCHEMA, MOTION_COMMAND_TYPES, MOTION_DEFAULT_DURATIONS, MOTION_DEFAULT_HOLD, MOTION_DIRECTIONS, MOTION_DRAW_EFFECT_ID, MOTION_DRAW_MS_PER_UNIT, MOTION_DRAW_RANGE, MOTION_EASE_CHOICES, MOTION_EASE_IN_OUT, MOTION_EASE_OUT, MOTION_EDIT_OPS, MOTION_ENTER_STYLES, MOTION_EXIT_STYLES, MOTION_IRIS_SHAPES, MOTION_ISSUE_CODES, MOTION_MIN_CHANGE_MS, MOTION_REPEAT_MODES, MOTION_SPEED_RANGE, MOTION_SPLIT_ORIENTATIONS, MOTION_TRIGGERS, type MotionBeatGrid, type MotionCamera, type MotionClip, type MotionClipItem, type MotionClipShape, type MotionColorPulseCommand, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionControl, type MotionCue, type MotionDirection, type MotionDrawCommand, type MotionDrawOrder, type MotionEasingCurve, type MotionEdit, type MotionEditOp, type MotionEditResult, type MotionEffectCommand, type MotionEnterCommand, type MotionEnterStyle, type MotionExitCommand, type MotionExitStyle, type MotionFadeCommand, type MotionFieldInput, type MotionFieldKind, type MotionFieldSpec, type MotionFit, type MotionFitOptions, type MotionFollowCommand, type MotionFrame, type MotionFrameOptions, type MotionGhost, type MotionIrisShape, type MotionIssue, type MotionIssueCode, type MotionIssueSeverity, type MotionMatch, type MotionMatchCommand, type MotionMorphCommand, type MotionMoveCommand, type MotionNarration, type MotionNodeEntry, type MotionOnionSkin, type MotionOverlayOptions, type MotionPath, type MotionPathOptions, type MotionPlayCommand, type MotionPreset, type MotionProperty, type MotionPulseCommand, type MotionRect, type MotionReveal, type MotionRotateCommand, type MotionScaleCommand, type MotionScene, MotionSceneFormatError, type MotionSegment, type MotionShakeCommand, type MotionShot, type MotionShotTiming, type MotionSmoothLeg, type MotionSplitOrientation, type MotionStyleCommand, type MotionSvgOptions, type MotionTeeterCommand, type MotionTimeline, type MotionTrigger, type MotionValue, type MotionWaitCommand, type MotionWaveCommand, type MotionWiggleCommand, activeSegment, applyMotionControlValues, applyMotionEdits, checkMotionScene, clipsShapeProblems, commandShapeProblems, compileMotionScene, createAnimationEditorToolProvider, createMotionScene, defaultMotionCommand, describeMotionElements, describeMotionShots, duplicateMotionCommandEdit, fitMotionRect, fitMotionScene, fitMotionSceneEdits, flairAtLeast, flairCurveFor, flairEaseFor, formatMotionNarration, freshShotId, fromFlairSvgMotion, fromFlairVectorEffect, highlightMotionSvg, indexMotionNodes, interpolateMotionValue, isMotionCommand, isMotionShot, matchMotionNodes, motionAddTrackKey, motionBeatAt, motionBeatTime, motionClipAttrs, motionClipLayout, motionCommandDuration, motionCommandFields, motionCommandRepeat, motionCommandRows, motionCommandSummary, motionCueChoices, motionCueFromKey, motionCueKey, motionCueTime, motionCycleDuration, motionEaseKey, motionEasingCurve, motionEasingGuides, motionEasingPath, motionFieldEdit, motionFieldLabel, motionFlairPrimitive, motionFollowRoute, motionFrameAt, motionFrameToSvg, motionGhosts, motionIssue, motionIssueKey, motionIssueLine, motionMovingIds, motionNodeAtElement, motionNodeClips, motionNodeOffset, motionPath, motionPathLength, motionPathsSvg, motionRestValue, motionRevealClip, motionRevealPadding, motionRulerTicks, motionSceneShapeProblems, motionSceneToJson, motionShotAt, motionShotCueTime, motionShotTimeScale, motionStageSvg, motionTrackKey, namedWithSuggestion, parseMotionFieldInput, parseMotionNarration, parseMotionScene, resolveMotionCamera, segmentProgress, segmentValue, shotShapeProblems, smoothMotionLegs, smoothMotionTimes, suggestName, toFlairEffectDocument, toFlairSvgMotion, toFlairVectorEffect, toLottie, trackValue, withMotionLayers, withViewBox };
|
|
2361
|
+
export { ANIMATION_EDITOR_AGENT_INSTRUCTIONS, AnimationEditorController, type AnimationEditorOptions, type AnimationEditorSelection, type AnimationEditorState, type AnimationEditorToolProviderOptions, FLAIR_EASES, FLAIR_EXPORT_VERSION, type FlairEase, type FlairEaseName, type FlairEffectDocument, type FlairEffectOptions, type FlairExportOptions, type FlairImportOptions, type FlairImportResult, type FlairMotionExport, type FlairSpringEase, type FlairSvgAnimation, type FlairSvgMotion, type FlairVectorEffect, type LottieAnimation, type LottieExport, type LottieExportOptions, type LottieKeyframe, type LottieShape, type LottieValue, MOTION_ADDITIVE_PROPERTIES, MOTION_BLENDS, MOTION_CAMERA_MS, MOTION_CLIP_TARGET, MOTION_COMMAND_SCHEMA, MOTION_COMMAND_TYPES, MOTION_DEFAULT_DURATIONS, MOTION_DEFAULT_HOLD, MOTION_DIRECTIONS, MOTION_DRAW_EFFECT_ID, MOTION_DRAW_MS_PER_UNIT, MOTION_DRAW_RANGE, MOTION_DRIVEN_PROPERTIES, MOTION_EASE_CHOICES, MOTION_EASE_IN_OUT, MOTION_EASE_OUT, MOTION_EDIT_OPS, MOTION_ENTER_STYLES, MOTION_EXIT_STYLES, MOTION_IRIS_SHAPES, MOTION_ISSUE_CODES, MOTION_MIN_CHANGE_MS, MOTION_REPEAT_MODES, MOTION_SPEED_RANGE, MOTION_SPLIT_ORIENTATIONS, MOTION_TRIGGERS, type MotionBeatGrid, type MotionCamera, type MotionClip, type MotionClipItem, type MotionClipShape, type MotionColorPulseCommand, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionContactSheetOptions, type MotionControl, type MotionCue, type MotionDirection, type MotionDrawCommand, type MotionDrawOrder, type MotionDrivenProperty, type MotionDriver, type MotionEasingCurve, type MotionEdit, type MotionEditOp, type MotionEditOutcome, type MotionEditResult, type MotionEffectCommand, type MotionEnterCommand, type MotionEnterStyle, type MotionExitCommand, type MotionExitStyle, type MotionFadeCommand, type MotionFieldInput, type MotionFieldKind, type MotionFieldSpec, type MotionFit, type MotionFitOptions, type MotionFollowCommand, type MotionFrame, type MotionFrameOptions, type MotionGhost, type MotionIrisShape, type MotionIssue, type MotionIssueCode, type MotionIssueSeverity, type MotionMatch, type MotionMatchCommand, type MotionMorphCommand, type MotionMoveCommand, type MotionNarration, type MotionNodeEntry, type MotionOnionSkin, type MotionOverlayOptions, type MotionPath, type MotionPathOptions, type MotionPlayCommand, type MotionPreset, type MotionProperty, type MotionPulseCommand, type MotionRect, type MotionReveal, type MotionRotateCommand, type MotionScaleCommand, type MotionScene, MotionSceneFormatError, type MotionSegment, type MotionShakeCommand, type MotionShot, type MotionShotTiming, type MotionSmoothLeg, type MotionSplitOrientation, type MotionStyleCommand, type MotionSvgOptions, type MotionTeeterCommand, type MotionTimeline, type MotionTrigger, type MotionValue, type MotionWaitCommand, type MotionWaveCommand, type MotionWiggleCommand, activeSegment, applyMotionControlValues, applyMotionDrivers, applyMotionEdits, checkMotionScene, clipsShapeProblems, commandShapeProblems, compileMotionScene, createAnimationEditorToolProvider, createMotionScene, defaultMotionCommand, describeMotionElements, describeMotionShots, driversShapeProblems, duplicateMotionCommandEdit, fitMotionRect, fitMotionScene, fitMotionSceneEdits, flairAtLeast, flairCurveFor, flairEaseFor, formatMotionDrivers, formatMotionNarration, freshShotId, fromFlairSvgMotion, fromFlairVectorEffect, highlightMotionSvg, indexMotionNodes, interpolateMotionValue, isMotionCommand, isMotionShot, matchMotionNodes, motionAddTrackKey, motionBeatAt, motionBeatTime, motionClipAttrs, motionClipLayout, motionCommandDuration, motionCommandFields, motionCommandRepeat, motionCommandRows, motionCommandSummary, motionContactSheetSvg, motionCueChoices, motionCueFromKey, motionCueKey, motionCueTime, motionCycleDuration, motionDrivenNodes, motionDriverSources, motionEaseKey, motionEasingCurve, motionEasingGuides, motionEasingPath, motionFieldEdit, motionFieldLabel, motionFlairPrimitive, motionFollowRoute, motionFrameAt, motionFrameToSvg, motionGhosts, motionIssue, motionIssueKey, motionIssueLine, motionMovingIds, motionNodeAtElement, motionNodeClips, motionNodeOffset, motionPath, motionPathLength, motionPathsSvg, motionPropertyValue, motionRestValue, motionRevealClip, motionRevealPadding, motionRulerTicks, motionSceneShapeProblems, motionSceneToJson, motionShotAt, motionShotCueTime, motionShotTimeScale, motionStageSvg, motionTrackKey, namedWithSuggestion, parseMotionDrivers, parseMotionFieldInput, parseMotionNarration, parseMotionScene, resolveMotionCamera, resolveMotionEditRefs, segmentProgress, segmentValue, shotShapeProblems, smoothMotionLegs, smoothMotionTimes, suggestName, toFlairEffectDocument, toFlairSvgMotion, toFlairVectorEffect, toLottie, trackValue, withMotionLayers, withViewBox };
|
|
@@ -56,6 +56,11 @@ interface MotionScene {
|
|
|
56
56
|
* node with a `play` command (a "pop and settle" or "attention" you use many times).
|
|
57
57
|
*/
|
|
58
58
|
clips?: Record<string, MotionClip>;
|
|
59
|
+
/**
|
|
60
|
+
* Properties that follow other properties: a background moving at half the speed of the
|
|
61
|
+
* foreground (parallax), a wheel turning as it rolls. Each adds to what its target's commands do.
|
|
62
|
+
*/
|
|
63
|
+
drivers?: MotionDriver[];
|
|
59
64
|
/** Parameters a Flair effect made from this scene exposes (see `toFlairVectorEffect`). */
|
|
60
65
|
controls?: MotionControl[];
|
|
61
66
|
/** Named sets of control values. */
|
|
@@ -331,6 +336,31 @@ interface MotionClip {
|
|
|
331
336
|
/** Commands, timed as in a shot; `"$"` in `targets` stands for the node played on. Clips cannot play clips. */
|
|
332
337
|
run: MotionCommand[];
|
|
333
338
|
}
|
|
339
|
+
/** Properties a driver reads and drives: offsets (document units), turn (degrees), scales and opacity. */
|
|
340
|
+
type MotionDrivenProperty = 'x' | 'y' | 'rotation' | 'scaleX' | 'scaleY' | 'opacity';
|
|
341
|
+
declare const MOTION_DRIVEN_PROPERTIES: readonly MotionDrivenProperty[];
|
|
342
|
+
/**
|
|
343
|
+
* One property following another. Both are read as a change from rest (offsets and turns from
|
|
344
|
+
* 0, scales and opacity from 1): the target's property changes by `source change · factor + offset`,
|
|
345
|
+
* clamped to `clamp`, on top of its own commands (added to offsets and turns, multiplied into
|
|
346
|
+
* scales and opacity as 1 + change).
|
|
347
|
+
*/
|
|
348
|
+
interface MotionDriver {
|
|
349
|
+
/** The node that follows. */
|
|
350
|
+
target: string;
|
|
351
|
+
property: MotionDrivenProperty;
|
|
352
|
+
/** The node and property it follows. */
|
|
353
|
+
source: {
|
|
354
|
+
node: string;
|
|
355
|
+
property: MotionDrivenProperty;
|
|
356
|
+
};
|
|
357
|
+
/** Default 1 (0.5 moves at half the speed; 360 / (2π·radius) turns a wheel by how far it rolls). */
|
|
358
|
+
factor?: number;
|
|
359
|
+
/** Added to the change (default 0). */
|
|
360
|
+
offset?: number;
|
|
361
|
+
/** Limits the change to `[min, max]`. */
|
|
362
|
+
clamp?: [number, number];
|
|
363
|
+
}
|
|
334
364
|
/** The placeholder target in a clip's commands. */
|
|
335
365
|
declare const MOTION_CLIP_TARGET = "$";
|
|
336
366
|
/** Plays a clip (`scene.clips`) on the targets: its commands, with `"$"` standing for each target. */
|
|
@@ -539,6 +569,10 @@ declare const MOTION_ISSUE_CODES: {
|
|
|
539
569
|
readonly severity: "warning";
|
|
540
570
|
readonly wording: "A wipe, iris or split cannot clip a node with no width or height (a lone straight line), so it fades instead.";
|
|
541
571
|
};
|
|
572
|
+
readonly 'driver-cycle': {
|
|
573
|
+
readonly severity: "error";
|
|
574
|
+
readonly wording: "Drivers follow each other in a loop, so none of them has a value.";
|
|
575
|
+
};
|
|
542
576
|
readonly 'unknown-clip': {
|
|
543
577
|
readonly severity: "error";
|
|
544
578
|
readonly wording: "A play command names a clip the scene does not have.";
|
|
@@ -682,6 +716,8 @@ declare class MotionSceneFormatError extends Error {
|
|
|
682
716
|
declare function commandShapeProblems(command: unknown, where: string): string[];
|
|
683
717
|
/** Problems with a scene's `clips`: names, and each clip's commands (which may target `"$"` but not play clips). */
|
|
684
718
|
declare function clipsShapeProblems(clips: unknown): string[];
|
|
719
|
+
/** Problems with a scene's `drivers`. */
|
|
720
|
+
declare function driversShapeProblems(drivers: unknown): string[];
|
|
685
721
|
/** Problems with one shot's shape. */
|
|
686
722
|
declare function shotShapeProblems(shot: unknown, where: string): string[];
|
|
687
723
|
/** Problems with a scene's shape (empty when well formed). */
|
|
@@ -782,6 +818,10 @@ interface MotionTimeline {
|
|
|
782
818
|
segments: MotionSegment[];
|
|
783
819
|
/** Segments per `node\u0000property`, in start order. */
|
|
784
820
|
tracks: ReadonlyMap<string, readonly MotionSegment[]>;
|
|
821
|
+
/** The scene's drivers (properties that follow other properties). */
|
|
822
|
+
drivers?: readonly MotionDriver[];
|
|
823
|
+
/** Rest opacity per node, for drivers that read opacity. */
|
|
824
|
+
restOpacity?: ReadonlyMap<string, number>;
|
|
785
825
|
}
|
|
786
826
|
/** Where a node sits in the artwork. */
|
|
787
827
|
interface MotionNodeEntry {
|
|
@@ -879,6 +919,20 @@ declare function motionBeatAt(grid: MotionBeatGrid, ms: number): {
|
|
|
879
919
|
};
|
|
880
920
|
/** The time a cue names, ms, or undefined when it names a beat with no grid or a word the narration lacks. */
|
|
881
921
|
declare function motionCueTime(scene: Pick<MotionScene, 'beat' | 'narration'>, cue: MotionCue): number | undefined;
|
|
922
|
+
/**
|
|
923
|
+
* A node property's value at `time` with its commands, additive layers and drivers: offsets and
|
|
924
|
+
* turns from 0, scales from 1, opacity from the node's own. `raw` ignores behaviours.
|
|
925
|
+
*/
|
|
926
|
+
declare function motionPropertyValue(timeline: MotionTimeline, node: string, property: MotionDrivenProperty, time: number, raw?: boolean, depth?: number): number;
|
|
927
|
+
/** `value` with the drivers of `node`'s `property` applied (a no-op without drivers). Chains of drivers are followed up to 8 deep; `check` reports cycles. */
|
|
928
|
+
declare function applyMotionDrivers(timeline: MotionTimeline, node: string, property: MotionDrivenProperty, value: number, time: number, raw?: boolean, depth?: number): number;
|
|
929
|
+
/** Nodes driven by a driver (directly). */
|
|
930
|
+
declare function motionDrivenNodes(timeline: MotionTimeline): Set<string>;
|
|
931
|
+
/**
|
|
932
|
+
* The segments a node's drivers depend on (its sources', followed down chains), for exporters that
|
|
933
|
+
* must sample a driven property wherever its sources change.
|
|
934
|
+
*/
|
|
935
|
+
declare function motionDriverSources(timeline: MotionTimeline, node: string, properties: readonly MotionDrivenProperty[], seen?: Set<string>): MotionSegment[];
|
|
882
936
|
/** How many times a command plays (1 for `enter`, `exit` and `wait`, which do not repeat). */
|
|
883
937
|
declare function motionCommandRepeat(command: MotionCommand): number;
|
|
884
938
|
/** How long one target of a command takes (ms), every repeat included. */
|
|
@@ -1100,6 +1154,17 @@ interface MotionOverlayOptions {
|
|
|
1100
1154
|
* `motionFrameToSvg`.
|
|
1101
1155
|
*/
|
|
1102
1156
|
declare function motionStageSvg(scene: MotionScene, time: number, options?: MotionSvgOptions & MotionOverlayOptions): string;
|
|
1157
|
+
interface MotionContactSheetOptions extends MotionSvgOptions, MotionOverlayOptions {
|
|
1158
|
+
/** Frames a row (default: about square). */
|
|
1159
|
+
columns?: number;
|
|
1160
|
+
/** Write each frame's time (and shot) under it (default true). */
|
|
1161
|
+
labels?: boolean;
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Several moments of the scene in one SVG, in a grid with each frame's time and shot under it:
|
|
1165
|
+
* a contact sheet, to see a whole animation (or an agent's change to it) at a glance.
|
|
1166
|
+
*/
|
|
1167
|
+
declare function motionContactSheetSvg(scene: MotionScene, times: readonly number[], options?: MotionContactSheetOptions): string;
|
|
1103
1168
|
|
|
1104
1169
|
/** Changes shorter than this (ms) are too quick to follow. */
|
|
1105
1170
|
declare const MOTION_MIN_CHANGE_MS = 120;
|
|
@@ -1174,6 +1239,9 @@ type MotionEdit = {
|
|
|
1174
1239
|
op: 'set_clip';
|
|
1175
1240
|
name: string;
|
|
1176
1241
|
clip: MotionClip | null;
|
|
1242
|
+
} | {
|
|
1243
|
+
op: 'set_drivers';
|
|
1244
|
+
drivers: MotionDriver[];
|
|
1177
1245
|
} | {
|
|
1178
1246
|
op: 'replace_scene';
|
|
1179
1247
|
scene: MotionScene;
|
|
@@ -1195,6 +1263,32 @@ type MotionEditResult = {
|
|
|
1195
1263
|
declare function freshShotId(scene: MotionScene, base?: string): string;
|
|
1196
1264
|
/** Applies edits in order, as one change. Fails without changing anything when one fails. */
|
|
1197
1265
|
declare function applyMotionEdits(scene: MotionScene, edits: MotionEdit | readonly MotionEdit[]): MotionEditResult;
|
|
1266
|
+
/** What one edit made, for later edits in a batch to refer to (`"$0.indexes[0]"`). */
|
|
1267
|
+
interface MotionEditOutcome {
|
|
1268
|
+
op: string;
|
|
1269
|
+
/** The shot it changed or added to. */
|
|
1270
|
+
shot?: string;
|
|
1271
|
+
/** Shots it added. */
|
|
1272
|
+
shots?: string[];
|
|
1273
|
+
/** Indexes of the commands it added (or where it moved one). */
|
|
1274
|
+
indexes?: number[];
|
|
1275
|
+
/** The clip it set. */
|
|
1276
|
+
clip?: string;
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Resolves references to earlier edits' outcomes in a batch: a string `"$N.path"` (`$last` for the
|
|
1280
|
+
* one before) is replaced by that value, e.g. `"$0.indexes[0]"` for the index of the first command
|
|
1281
|
+
* edit 0 added; `"$$..."` is a literal `$`. Returns the resolved edits with what each made, or why
|
|
1282
|
+
* a reference does not resolve. Nothing is applied.
|
|
1283
|
+
*/
|
|
1284
|
+
declare function resolveMotionEditRefs(scene: MotionScene, edits: readonly MotionEdit[]): {
|
|
1285
|
+
ok: true;
|
|
1286
|
+
edits: MotionEdit[];
|
|
1287
|
+
outcomes: MotionEditOutcome[];
|
|
1288
|
+
} | {
|
|
1289
|
+
ok: false;
|
|
1290
|
+
error: string;
|
|
1291
|
+
};
|
|
1198
1292
|
/** An empty scene over `artwork`. */
|
|
1199
1293
|
declare function createMotionScene(artwork: VectorDocument, init?: Partial<Omit<MotionScene, 'artwork' | 'version'>>): MotionScene;
|
|
1200
1294
|
|
|
@@ -2109,7 +2203,7 @@ declare function createAnimationEditorToolProvider(controller: AnimationEditorCo
|
|
|
2109
2203
|
* A short authoring guide for a model writing vector animations with the animation editor's
|
|
2110
2204
|
* tools. Static, so it caches well as part of a system prompt.
|
|
2111
2205
|
*/
|
|
2112
|
-
declare const ANIMATION_EDITOR_AGENT_INSTRUCTIONS = "You animate vector artwork. A scene is artwork (vector paths and groups, each with an id) plus shots.\n\nHow it plays\n- Shots play in order. A shot optionally moves the camera, plays its commands, then holds (default 600 ms).\n- Commands in a shot play one after another; give \"with\": \"previous\" to start one together with the command before, \"delay\" to wait, \"stagger\" to offset several targets.\n- Timing comes from the content: each command has a default length (enter 600 ms, move 700 ms, draw follows the path length). Only set \"duration\" to change the pace.\n- Anything that enters later is hidden until it enters. Things that never enter are visible from the start.\n- Every frame is a pure function of time: the same scene always plays the same frames.\n\nCommands\n- enter (fade, pop, grow, slide, draw) and exit (fade, shrink, slide, undraw) bring things in and out.\n- enter also reveals through a clip over the target's box: wipe (behind an edge travelling \"direction\", default right), iris (from the centre; \"shape\": circle or box) and split (from a line through the middle; \"orientation\": horizontal or vertical). exit wipe hides the same way. Reveals need a width and a height: use draw / undraw for a straight line.\n- draw draws strokes on to a fraction; move, rotate, scale and fade change the pose (about the centre); style blends solid colours and stroke width.\n- Drawing a group of strokes: \"order\": \"sequence\" draws them one after another (a signature, a diagram), \"sortBy\": \"distance\" from \"origin\" reveals outward, \"pace\": \"speed\" keeps one speed; draw with \"comet\": 0.2 sends a short stroke along a path and off the end.\n- Reuse motion: set_animation_clip defines a clip (commands targeting \"$\"), and { \"type\": \"play\", \"clip\": name, \"targets\": [...] } plays it on any nodes (with stagger and speed). copy_animation gives other nodes one node's motion.\n- move takes \"via\" waypoints for a curved, smooth path that passes exactly through each point (steady speed by default); use it instead of chaining moves, which stop at each point.\n- enter also has zoom (settles from larger) and rise (rises a short way, overshooting a touch); pop and zoom take a starting \"scale\".\n- morph turns a shape into another node's shape (keep the target hidden); match does the same for a whole group, part by part (Smart Animate: draw the end state as a second, hidden group whose parts share names with the first); follow moves along a path node (with \"rotate\", moves made meanwhile turn with the path).\n- Emphasis draws the eye and returns to rest: pulse (swell), shake (side to side, or \"axis\": \"vertical\"), teeter (rock), wave (bob, no settling), wiggle (seeded wander; the same seed wanders the same way) and color-pulse (tint and back).\n- Emphasis stacks on other motion: a shake during a slide shakes as it slides. Give move, rotate or scale \"blend\": \"add\" to stack them too (what they add stays); \"blend\": \"replace\" makes a change take over instead.\n- Any command but enter and exit can \"repeat\" (loop, mirror back and forth, or offset to carry on: rotate by 90, repeat 4 is a full turn); \"duration\" is one cycle.\n- Springs (\"spring-gentle\", \"spring-quick\", \"spring-bouncy\", \"spring-slow\" or { \"type\": \"spring\", \u2026 }) feel physical; leave \"duration\" out and the spring sets it.\n- To time shots to music or a voiceover: set a \"beat\" grid or \"narration\" word timings with set_animation_settings, read them with get_timing_grid, and give a shot \"at\": { \"beat\": n } or { \"word\": i }. The shot before holds until the cue; check_animation warns when a cue is missed.\n- \"steps\": 12 (on a command, or for the whole scene with set_animation_settings) holds poses \"on twos\" for a hand-drawn look. \"geometric\": true on scale or a camera zooms at an even rate.\n- Commands share their names and defaults with Flair's motion primitives (get_animation shows each one's \"flairPrimitive\"), and emphasis, reveals and follows export to Flair exactly.\n- effect tweens a numeric parameter of a live path effect already on the node (twist angle, wiggle time, zig zag size).\n\nWorking method\n1. get_animation to learn the element ids (set_animation_artwork_svg first if there is no artwork: give every element you will animate an id; or import_flair_effect to start from a Flair effect and edit it).\n2. Plan a few shots, each one idea. Add them with insert_shots (add_commands, update_command, move_command and delete_commands refine a shot), or edit_animation to make several edits as one step (dry_run first when unsure).\n3. To hit a length, fit_animation (keep the shots whose pace matters). check_animation and fix every error and warning; render_animation_frame (shot + \"end\") to look at the result; add onion_skin or motion_paths to see the motion in one picture, or get_motion_path for the numbers.\n- For something the viewer plays (a button, a toggle, a step-by-step explainer), set \"trigger\" with set_animation_settings: click plays the next shot on each click and then starts over (make the last shot put things back for a toggle), hover or press plays and rewinds, scroll scrubs.\n4. To make a reusable Flair effect, set_animation_controls (colour controls stand for every use of their default colour) and export_flair_effect.\n\nKeep motion purposeful: one thing moving at a time reads best, ease-out for arrivals, ease-in for exits, and hold long enough to see each result.";
|
|
2206
|
+
declare const ANIMATION_EDITOR_AGENT_INSTRUCTIONS = "You animate vector artwork. A scene is artwork (vector paths and groups, each with an id) plus shots.\n\nHow it plays\n- Shots play in order. A shot optionally moves the camera, plays its commands, then holds (default 600 ms).\n- Commands in a shot play one after another; give \"with\": \"previous\" to start one together with the command before, \"delay\" to wait, \"stagger\" to offset several targets.\n- Timing comes from the content: each command has a default length (enter 600 ms, move 700 ms, draw follows the path length). Only set \"duration\" to change the pace.\n- Anything that enters later is hidden until it enters. Things that never enter are visible from the start.\n- Every frame is a pure function of time: the same scene always plays the same frames.\n\nCommands\n- enter (fade, pop, grow, slide, draw) and exit (fade, shrink, slide, undraw) bring things in and out.\n- enter also reveals through a clip over the target's box: wipe (behind an edge travelling \"direction\", default right), iris (from the centre; \"shape\": circle or box) and split (from a line through the middle; \"orientation\": horizontal or vertical). exit wipe hides the same way. Reveals need a width and a height: use draw / undraw for a straight line.\n- draw draws strokes on to a fraction; move, rotate, scale and fade change the pose (about the centre); style blends solid colours and stroke width.\n- Drawing a group of strokes: \"order\": \"sequence\" draws them one after another (a signature, a diagram), \"sortBy\": \"distance\" from \"origin\" reveals outward, \"pace\": \"speed\" keeps one speed; draw with \"comet\": 0.2 sends a short stroke along a path and off the end.\n- Tie properties together with set_animation_drivers: parallax layers, a wheel that turns as it rolls, a shadow that fades as something rises. Drivers add to the target's own commands.\n- Reuse motion: set_animation_clip defines a clip (commands targeting \"$\"), and { \"type\": \"play\", \"clip\": name, \"targets\": [...] } plays it on any nodes (with stagger and speed). copy_animation gives other nodes one node's motion.\n- move takes \"via\" waypoints for a curved, smooth path that passes exactly through each point (steady speed by default); use it instead of chaining moves, which stop at each point.\n- enter also has zoom (settles from larger) and rise (rises a short way, overshooting a touch); pop and zoom take a starting \"scale\".\n- morph turns a shape into another node's shape (keep the target hidden); match does the same for a whole group, part by part (Smart Animate: draw the end state as a second, hidden group whose parts share names with the first); follow moves along a path node (with \"rotate\", moves made meanwhile turn with the path).\n- Emphasis draws the eye and returns to rest: pulse (swell), shake (side to side, or \"axis\": \"vertical\"), teeter (rock), wave (bob, no settling), wiggle (seeded wander; the same seed wanders the same way) and color-pulse (tint and back).\n- Emphasis stacks on other motion: a shake during a slide shakes as it slides. Give move, rotate or scale \"blend\": \"add\" to stack them too (what they add stays); \"blend\": \"replace\" makes a change take over instead.\n- Any command but enter and exit can \"repeat\" (loop, mirror back and forth, or offset to carry on: rotate by 90, repeat 4 is a full turn); \"duration\" is one cycle.\n- Springs (\"spring-gentle\", \"spring-quick\", \"spring-bouncy\", \"spring-slow\" or { \"type\": \"spring\", \u2026 }) feel physical; leave \"duration\" out and the spring sets it.\n- To time shots to music or a voiceover: set a \"beat\" grid or \"narration\" word timings with set_animation_settings, read them with get_timing_grid, and give a shot \"at\": { \"beat\": n } or { \"word\": i }. The shot before holds until the cue; check_animation warns when a cue is missed.\n- \"steps\": 12 (on a command, or for the whole scene with set_animation_settings) holds poses \"on twos\" for a hand-drawn look. \"geometric\": true on scale or a camera zooms at an even rate.\n- Commands share their names and defaults with Flair's motion primitives (get_animation shows each one's \"flairPrimitive\"), and emphasis, reveals and follows export to Flair exactly.\n- effect tweens a numeric parameter of a live path effect already on the node (twist angle, wiggle time, zig zag size).\n\nWorking method\n1. get_animation to learn the element ids (set_animation_artwork_svg first if there is no artwork: give every element you will animate an id; or import_flair_effect to start from a Flair effect and edit it).\n2. Plan a few shots, each one idea. Add them with insert_shots (add_commands, update_command, move_command and delete_commands refine a shot), or edit_animation to make several edits as one step (dry_run first when unsure).\n- In edit_animation, a later op can use what an earlier one made: \"$0.indexes[0]\" (the first command op 1 added), \"$last.shot\".\n3. To hit a length, fit_animation (keep the shots whose pace matters). check_animation and fix every error and warning; render_animation_frame (shot + \"end\") to look at the result, or with \"times\" for a contact sheet of several moments; add onion_skin or motion_paths to see the motion in one picture, or get_motion_path for the numbers.\n- For something the viewer plays (a button, a toggle, a step-by-step explainer), set \"trigger\" with set_animation_settings: click plays the next shot on each click and then starts over (make the last shot put things back for a toggle), hover or press plays and rewinds, scroll scrubs.\n4. To make a reusable Flair effect, set_animation_controls (colour controls stand for every use of their default colour) and export_flair_effect.\n\nKeep motion purposeful: one thing moving at a time reads best, ease-out for arrivals, ease-in for exits, and hold long enough to see each result.";
|
|
2113
2207
|
|
|
2114
2208
|
/**
|
|
2115
2209
|
* Helpers for hand-editing UIs (React's and Svelte's command inspector, ease picker, cue picker,
|
|
@@ -2255,5 +2349,13 @@ declare function parseMotionNarration(text: string): {
|
|
|
2255
2349
|
} | {
|
|
2256
2350
|
error: string;
|
|
2257
2351
|
};
|
|
2352
|
+
/** Drivers as text, one a line: `dot.x <- box.x * 0.5 + 2 [-10, 10]` (factor, offset and clamp optional). */
|
|
2353
|
+
declare function formatMotionDrivers(drivers: readonly MotionDriver[] | undefined): string;
|
|
2354
|
+
/** Reads drivers typed one a line (see `formatMotionDrivers`); empty text clears them. */
|
|
2355
|
+
declare function parseMotionDrivers(text: string): {
|
|
2356
|
+
drivers: MotionDriver[];
|
|
2357
|
+
} | {
|
|
2358
|
+
error: string;
|
|
2359
|
+
};
|
|
2258
2360
|
|
|
2259
|
-
export { ANIMATION_EDITOR_AGENT_INSTRUCTIONS, AnimationEditorController, type AnimationEditorOptions, type AnimationEditorSelection, type AnimationEditorState, type AnimationEditorToolProviderOptions, FLAIR_EASES, FLAIR_EXPORT_VERSION, type FlairEase, type FlairEaseName, type FlairEffectDocument, type FlairEffectOptions, type FlairExportOptions, type FlairImportOptions, type FlairImportResult, type FlairMotionExport, type FlairSpringEase, type FlairSvgAnimation, type FlairSvgMotion, type FlairVectorEffect, type LottieAnimation, type LottieExport, type LottieExportOptions, type LottieKeyframe, type LottieShape, type LottieValue, MOTION_ADDITIVE_PROPERTIES, MOTION_BLENDS, MOTION_CAMERA_MS, MOTION_CLIP_TARGET, MOTION_COMMAND_SCHEMA, MOTION_COMMAND_TYPES, MOTION_DEFAULT_DURATIONS, MOTION_DEFAULT_HOLD, MOTION_DIRECTIONS, MOTION_DRAW_EFFECT_ID, MOTION_DRAW_MS_PER_UNIT, MOTION_DRAW_RANGE, MOTION_EASE_CHOICES, MOTION_EASE_IN_OUT, MOTION_EASE_OUT, MOTION_EDIT_OPS, MOTION_ENTER_STYLES, MOTION_EXIT_STYLES, MOTION_IRIS_SHAPES, MOTION_ISSUE_CODES, MOTION_MIN_CHANGE_MS, MOTION_REPEAT_MODES, MOTION_SPEED_RANGE, MOTION_SPLIT_ORIENTATIONS, MOTION_TRIGGERS, type MotionBeatGrid, type MotionCamera, type MotionClip, type MotionClipItem, type MotionClipShape, type MotionColorPulseCommand, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionControl, type MotionCue, type MotionDirection, type MotionDrawCommand, type MotionDrawOrder, type MotionEasingCurve, type MotionEdit, type MotionEditOp, type MotionEditResult, type MotionEffectCommand, type MotionEnterCommand, type MotionEnterStyle, type MotionExitCommand, type MotionExitStyle, type MotionFadeCommand, type MotionFieldInput, type MotionFieldKind, type MotionFieldSpec, type MotionFit, type MotionFitOptions, type MotionFollowCommand, type MotionFrame, type MotionFrameOptions, type MotionGhost, type MotionIrisShape, type MotionIssue, type MotionIssueCode, type MotionIssueSeverity, type MotionMatch, type MotionMatchCommand, type MotionMorphCommand, type MotionMoveCommand, type MotionNarration, type MotionNodeEntry, type MotionOnionSkin, type MotionOverlayOptions, type MotionPath, type MotionPathOptions, type MotionPlayCommand, type MotionPreset, type MotionProperty, type MotionPulseCommand, type MotionRect, type MotionReveal, type MotionRotateCommand, type MotionScaleCommand, type MotionScene, MotionSceneFormatError, type MotionSegment, type MotionShakeCommand, type MotionShot, type MotionShotTiming, type MotionSmoothLeg, type MotionSplitOrientation, type MotionStyleCommand, type MotionSvgOptions, type MotionTeeterCommand, type MotionTimeline, type MotionTrigger, type MotionValue, type MotionWaitCommand, type MotionWaveCommand, type MotionWiggleCommand, activeSegment, applyMotionControlValues, applyMotionEdits, checkMotionScene, clipsShapeProblems, commandShapeProblems, compileMotionScene, createAnimationEditorToolProvider, createMotionScene, defaultMotionCommand, describeMotionElements, describeMotionShots, duplicateMotionCommandEdit, fitMotionRect, fitMotionScene, fitMotionSceneEdits, flairAtLeast, flairCurveFor, flairEaseFor, formatMotionNarration, freshShotId, fromFlairSvgMotion, fromFlairVectorEffect, highlightMotionSvg, indexMotionNodes, interpolateMotionValue, isMotionCommand, isMotionShot, matchMotionNodes, motionAddTrackKey, motionBeatAt, motionBeatTime, motionClipAttrs, motionClipLayout, motionCommandDuration, motionCommandFields, motionCommandRepeat, motionCommandRows, motionCommandSummary, motionCueChoices, motionCueFromKey, motionCueKey, motionCueTime, motionCycleDuration, motionEaseKey, motionEasingCurve, motionEasingGuides, motionEasingPath, motionFieldEdit, motionFieldLabel, motionFlairPrimitive, motionFollowRoute, motionFrameAt, motionFrameToSvg, motionGhosts, motionIssue, motionIssueKey, motionIssueLine, motionMovingIds, motionNodeAtElement, motionNodeClips, motionNodeOffset, motionPath, motionPathLength, motionPathsSvg, motionRestValue, motionRevealClip, motionRevealPadding, motionRulerTicks, motionSceneShapeProblems, motionSceneToJson, motionShotAt, motionShotCueTime, motionShotTimeScale, motionStageSvg, motionTrackKey, namedWithSuggestion, parseMotionFieldInput, parseMotionNarration, parseMotionScene, resolveMotionCamera, segmentProgress, segmentValue, shotShapeProblems, smoothMotionLegs, smoothMotionTimes, suggestName, toFlairEffectDocument, toFlairSvgMotion, toFlairVectorEffect, toLottie, trackValue, withMotionLayers, withViewBox };
|
|
2361
|
+
export { ANIMATION_EDITOR_AGENT_INSTRUCTIONS, AnimationEditorController, type AnimationEditorOptions, type AnimationEditorSelection, type AnimationEditorState, type AnimationEditorToolProviderOptions, FLAIR_EASES, FLAIR_EXPORT_VERSION, type FlairEase, type FlairEaseName, type FlairEffectDocument, type FlairEffectOptions, type FlairExportOptions, type FlairImportOptions, type FlairImportResult, type FlairMotionExport, type FlairSpringEase, type FlairSvgAnimation, type FlairSvgMotion, type FlairVectorEffect, type LottieAnimation, type LottieExport, type LottieExportOptions, type LottieKeyframe, type LottieShape, type LottieValue, MOTION_ADDITIVE_PROPERTIES, MOTION_BLENDS, MOTION_CAMERA_MS, MOTION_CLIP_TARGET, MOTION_COMMAND_SCHEMA, MOTION_COMMAND_TYPES, MOTION_DEFAULT_DURATIONS, MOTION_DEFAULT_HOLD, MOTION_DIRECTIONS, MOTION_DRAW_EFFECT_ID, MOTION_DRAW_MS_PER_UNIT, MOTION_DRAW_RANGE, MOTION_DRIVEN_PROPERTIES, MOTION_EASE_CHOICES, MOTION_EASE_IN_OUT, MOTION_EASE_OUT, MOTION_EDIT_OPS, MOTION_ENTER_STYLES, MOTION_EXIT_STYLES, MOTION_IRIS_SHAPES, MOTION_ISSUE_CODES, MOTION_MIN_CHANGE_MS, MOTION_REPEAT_MODES, MOTION_SPEED_RANGE, MOTION_SPLIT_ORIENTATIONS, MOTION_TRIGGERS, type MotionBeatGrid, type MotionCamera, type MotionClip, type MotionClipItem, type MotionClipShape, type MotionColorPulseCommand, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionContactSheetOptions, type MotionControl, type MotionCue, type MotionDirection, type MotionDrawCommand, type MotionDrawOrder, type MotionDrivenProperty, type MotionDriver, type MotionEasingCurve, type MotionEdit, type MotionEditOp, type MotionEditOutcome, type MotionEditResult, type MotionEffectCommand, type MotionEnterCommand, type MotionEnterStyle, type MotionExitCommand, type MotionExitStyle, type MotionFadeCommand, type MotionFieldInput, type MotionFieldKind, type MotionFieldSpec, type MotionFit, type MotionFitOptions, type MotionFollowCommand, type MotionFrame, type MotionFrameOptions, type MotionGhost, type MotionIrisShape, type MotionIssue, type MotionIssueCode, type MotionIssueSeverity, type MotionMatch, type MotionMatchCommand, type MotionMorphCommand, type MotionMoveCommand, type MotionNarration, type MotionNodeEntry, type MotionOnionSkin, type MotionOverlayOptions, type MotionPath, type MotionPathOptions, type MotionPlayCommand, type MotionPreset, type MotionProperty, type MotionPulseCommand, type MotionRect, type MotionReveal, type MotionRotateCommand, type MotionScaleCommand, type MotionScene, MotionSceneFormatError, type MotionSegment, type MotionShakeCommand, type MotionShot, type MotionShotTiming, type MotionSmoothLeg, type MotionSplitOrientation, type MotionStyleCommand, type MotionSvgOptions, type MotionTeeterCommand, type MotionTimeline, type MotionTrigger, type MotionValue, type MotionWaitCommand, type MotionWaveCommand, type MotionWiggleCommand, activeSegment, applyMotionControlValues, applyMotionDrivers, applyMotionEdits, checkMotionScene, clipsShapeProblems, commandShapeProblems, compileMotionScene, createAnimationEditorToolProvider, createMotionScene, defaultMotionCommand, describeMotionElements, describeMotionShots, driversShapeProblems, duplicateMotionCommandEdit, fitMotionRect, fitMotionScene, fitMotionSceneEdits, flairAtLeast, flairCurveFor, flairEaseFor, formatMotionDrivers, formatMotionNarration, freshShotId, fromFlairSvgMotion, fromFlairVectorEffect, highlightMotionSvg, indexMotionNodes, interpolateMotionValue, isMotionCommand, isMotionShot, matchMotionNodes, motionAddTrackKey, motionBeatAt, motionBeatTime, motionClipAttrs, motionClipLayout, motionCommandDuration, motionCommandFields, motionCommandRepeat, motionCommandRows, motionCommandSummary, motionContactSheetSvg, motionCueChoices, motionCueFromKey, motionCueKey, motionCueTime, motionCycleDuration, motionDrivenNodes, motionDriverSources, motionEaseKey, motionEasingCurve, motionEasingGuides, motionEasingPath, motionFieldEdit, motionFieldLabel, motionFlairPrimitive, motionFollowRoute, motionFrameAt, motionFrameToSvg, motionGhosts, motionIssue, motionIssueKey, motionIssueLine, motionMovingIds, motionNodeAtElement, motionNodeClips, motionNodeOffset, motionPath, motionPathLength, motionPathsSvg, motionPropertyValue, motionRestValue, motionRevealClip, motionRevealPadding, motionRulerTicks, motionSceneShapeProblems, motionSceneToJson, motionShotAt, motionShotCueTime, motionShotTimeScale, motionStageSvg, motionTrackKey, namedWithSuggestion, parseMotionDrivers, parseMotionFieldInput, parseMotionNarration, parseMotionScene, resolveMotionCamera, resolveMotionEditRefs, segmentProgress, segmentValue, shotShapeProblems, smoothMotionLegs, smoothMotionTimes, suggestName, toFlairEffectDocument, toFlairSvgMotion, toFlairVectorEffect, toLottie, trackValue, withMotionLayers, withViewBox };
|