@pixerate/editor 0.68.0 → 0.70.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.
@@ -51,6 +51,11 @@ interface MotionScene {
51
51
  narration?: MotionNarration;
52
52
  /** Wanted length in seconds `[min, max]`; `check` warns outside it. */
53
53
  target?: [number, number];
54
+ /**
55
+ * Reusable motion: named command lists written against the target `"$"`, played on any
56
+ * node with a `play` command (a "pop and settle" or "attention" you use many times).
57
+ */
58
+ clips?: Record<string, MotionClip>;
54
59
  /** Parameters a Flair effect made from this scene exposes (see `toFlairVectorEffect`). */
55
60
  controls?: MotionControl[];
56
61
  /** Named sets of control values. */
@@ -169,7 +174,7 @@ type MotionSplitOrientation = 'horizontal' | 'vertical';
169
174
  * Brings hidden targets in. Targets entered in a shot are hidden before it. Each style is a
170
175
  * Flair motion primitive (`entrance.<style>`) with the same defaults.
171
176
  */
172
- interface MotionEnterCommand extends MotionCommandBase {
177
+ interface MotionEnterCommand extends MotionCommandBase, MotionDrawOrder {
173
178
  type: 'enter';
174
179
  /**
175
180
  * Default `fade`. `draw` draws the outline on, then fades the fill in. `pop` scales up past
@@ -193,7 +198,7 @@ interface MotionEnterCommand extends MotionCommandBase {
193
198
  orientation?: MotionSplitOrientation;
194
199
  }
195
200
  /** Takes targets out. */
196
- interface MotionExitCommand extends MotionCommandBase {
201
+ interface MotionExitCommand extends MotionCommandBase, MotionDrawOrder {
197
202
  type: 'exit';
198
203
  /** Default `fade`. `wipe` hides the target behind an edge travelling `direction` (a wipe in, reversed). */
199
204
  style?: MotionExitStyle;
@@ -201,9 +206,33 @@ interface MotionExitCommand extends MotionCommandBase {
201
206
  direction?: MotionDirection;
202
207
  distance?: number;
203
208
  }
209
+ /**
210
+ * How the strokes of a group (or several paths) draw on or off together. Default: all at once,
211
+ * each over the whole time.
212
+ */
213
+ interface MotionDrawOrder {
214
+ /** `together` (default) or `sequence`: one stroke after another, each for a time in proportion to its length. */
215
+ order?: 'together' | 'sequence';
216
+ /** With `together`: `time` (default) gives every stroke the whole time; `speed` draws them all at one speed, so short ones take less. */
217
+ pace?: 'time' | 'speed';
218
+ /** With `pace: "speed"`: `start` (default) starts them together, `end` finishes them together. */
219
+ align?: 'start' | 'end';
220
+ /** With `sequence`: `document` (default, stacking order) or `distance` from `origin` (a radial reveal). */
221
+ sortBy?: 'document' | 'distance';
222
+ /** With `sortBy: "distance"`: the point (document units) strokes are drawn out from (default the target's centre). */
223
+ origin?: {
224
+ x: number;
225
+ y: number;
226
+ };
227
+ }
204
228
  /** Draws a stroke on (or off) between two fractions of its length. */
205
- interface MotionDrawCommand extends MotionCommandBase {
229
+ interface MotionDrawCommand extends MotionCommandBase, MotionDrawOrder {
206
230
  type: 'draw';
231
+ /**
232
+ * A travelling stroke this fraction of the length long (0–1): it runs along the path and off
233
+ * the end, instead of drawing it on and leaving it.
234
+ */
235
+ comet?: number;
207
236
  /** Fraction drawn at the end (default 1). */
208
237
  to?: number;
209
238
  /** Fraction drawn at the start (default: what is drawn now). */
@@ -296,6 +325,22 @@ interface MotionMatchCommand extends MotionCommandBase {
296
325
  /** Id of the group (or node) to become. */
297
326
  into: string;
298
327
  }
328
+ /** A reusable piece of motion: commands that target `"$"` (whatever `play` names), timed as in a shot. */
329
+ interface MotionClip {
330
+ description?: string;
331
+ /** Commands, timed as in a shot; `"$"` in `targets` stands for the node played on. Clips cannot play clips. */
332
+ run: MotionCommand[];
333
+ }
334
+ /** The placeholder target in a clip's commands. */
335
+ declare const MOTION_CLIP_TARGET = "$";
336
+ /** Plays a clip (`scene.clips`) on the targets: its commands, with `"$"` standing for each target. */
337
+ interface MotionPlayCommand extends MotionCommandBase {
338
+ type: 'play';
339
+ /** The clip's name. */
340
+ clip: string;
341
+ /** Play it this many times as fast (default 1). */
342
+ speed?: number;
343
+ }
299
344
  /** Moves targets along a path node, centre on the path. */
300
345
  interface MotionFollowCommand extends MotionCommandBase {
301
346
  type: 'follow';
@@ -419,7 +464,7 @@ interface MotionWaitCommand {
419
464
  with?: 'after' | 'previous';
420
465
  note?: string;
421
466
  }
422
- type MotionCommand = MotionEnterCommand | MotionExitCommand | MotionDrawCommand | MotionMoveCommand | MotionRotateCommand | MotionScaleCommand | MotionFadeCommand | MotionStyleCommand | MotionMorphCommand | MotionMatchCommand | MotionFollowCommand | MotionPulseCommand | MotionShakeCommand | MotionTeeterCommand | MotionWaveCommand | MotionWiggleCommand | MotionColorPulseCommand | MotionEffectCommand | MotionWaitCommand;
467
+ type MotionCommand = MotionEnterCommand | MotionExitCommand | MotionDrawCommand | MotionMoveCommand | MotionRotateCommand | MotionScaleCommand | MotionFadeCommand | MotionStyleCommand | MotionMorphCommand | MotionMatchCommand | MotionPlayCommand | MotionFollowCommand | MotionPulseCommand | MotionShakeCommand | MotionTeeterCommand | MotionWaveCommand | MotionWiggleCommand | MotionColorPulseCommand | MotionEffectCommand | MotionWaitCommand;
423
468
  type MotionCommandType = MotionCommand['type'];
424
469
  declare const MOTION_COMMAND_TYPES: readonly MotionCommandType[];
425
470
  declare const MOTION_ENTER_STYLES: readonly MotionEnterStyle[];
@@ -494,6 +539,10 @@ declare const MOTION_ISSUE_CODES: {
494
539
  readonly severity: "warning";
495
540
  readonly wording: "A wipe, iris or split cannot clip a node with no width or height (a lone straight line), so it fades instead.";
496
541
  };
542
+ readonly 'unknown-clip': {
543
+ readonly severity: "error";
544
+ readonly wording: "A play command names a clip the scene does not have.";
545
+ };
497
546
  readonly 'unknown-shape': {
498
547
  readonly severity: "error";
499
548
  readonly wording: "A morph names a shape the artwork does not have.";
@@ -631,6 +680,8 @@ declare class MotionSceneFormatError extends Error {
631
680
  }
632
681
  /** Problems with one command's shape (empty when well formed). `where` prefixes each. */
633
682
  declare function commandShapeProblems(command: unknown, where: string): string[];
683
+ /** Problems with a scene's `clips`: names, and each clip's commands (which may target `"$"` but not play clips). */
684
+ declare function clipsShapeProblems(clips: unknown): string[];
634
685
  /** Problems with one shot's shape. */
635
686
  declare function shotShapeProblems(shot: unknown, where: string): string[];
636
687
  /** Problems with a scene's shape (empty when well formed). */
@@ -832,6 +883,20 @@ declare function motionCueTime(scene: Pick<MotionScene, 'beat' | 'narration'>, c
832
883
  declare function motionCommandRepeat(command: MotionCommand): number;
833
884
  /** How long one target of a command takes (ms), every repeat included. */
834
885
  declare function motionCommandDuration(command: MotionCommand, scene: MotionScene, target?: string): number;
886
+ /** One command of a clip played on a target: when it starts (ms from the play's start), its target and one cycle's length. */
887
+ interface MotionClipItem {
888
+ command: Exclude<MotionCommand, {
889
+ type: 'wait';
890
+ }>;
891
+ target: string;
892
+ start: number;
893
+ cycle: number;
894
+ }
895
+ /** A clip's commands for `target` (`"$"` replaced), timed as in a shot from 0 at `speed`; unknown clips give nothing. */
896
+ declare function motionClipLayout(scene: MotionScene, clip: string, target: string, speed?: number): {
897
+ items: MotionClipItem[];
898
+ length: number;
899
+ };
835
900
  /** How long one cycle of a command takes for one target (ms): its `duration`, a spring's settle time, the line's length for a draw, or the type's default. */
836
901
  declare function motionCycleDuration(command: MotionCommand, scene: MotionScene, target?: string): number;
837
902
  /** Cubic ease-out, `1 − (1 − t)³` exactly (Flair's `out`): the default for things arriving. */
@@ -1105,6 +1170,10 @@ type MotionEdit = {
1105
1170
  op: 'set_controls';
1106
1171
  controls: MotionControl[];
1107
1172
  presets?: MotionPreset[];
1173
+ } | {
1174
+ op: 'set_clip';
1175
+ name: string;
1176
+ clip: MotionClip | null;
1108
1177
  } | {
1109
1178
  op: 'replace_scene';
1110
1179
  scene: MotionScene;
@@ -1629,6 +1698,14 @@ declare function describeMotionShots(scene: MotionScene): {
1629
1698
  repeat?: number;
1630
1699
  repeatMode?: "loop" | "mirror" | "offset";
1631
1700
  steps?: number;
1701
+ order?: "together" | "sequence";
1702
+ pace?: "time" | "speed";
1703
+ align?: "start" | "end";
1704
+ sortBy?: "document" | "distance";
1705
+ origin?: {
1706
+ x: number;
1707
+ y: number;
1708
+ };
1632
1709
  index: number;
1633
1710
  } | {
1634
1711
  flairPrimitive?: string | undefined;
@@ -1648,12 +1725,21 @@ declare function describeMotionShots(scene: MotionScene): {
1648
1725
  repeat?: number;
1649
1726
  repeatMode?: "loop" | "mirror" | "offset";
1650
1727
  steps?: number;
1728
+ order?: "together" | "sequence";
1729
+ pace?: "time" | "speed";
1730
+ align?: "start" | "end";
1731
+ sortBy?: "document" | "distance";
1732
+ origin?: {
1733
+ x: number;
1734
+ y: number;
1735
+ };
1651
1736
  index: number;
1652
1737
  } | {
1653
1738
  flairPrimitive?: string | undefined;
1654
1739
  start: number;
1655
1740
  end: number;
1656
1741
  type: "draw";
1742
+ comet?: number;
1657
1743
  to?: number;
1658
1744
  from?: number;
1659
1745
  targets: string[];
@@ -1666,6 +1752,14 @@ declare function describeMotionShots(scene: MotionScene): {
1666
1752
  repeat?: number;
1667
1753
  repeatMode?: "loop" | "mirror" | "offset";
1668
1754
  steps?: number;
1755
+ order?: "together" | "sequence";
1756
+ pace?: "time" | "speed";
1757
+ align?: "start" | "end";
1758
+ sortBy?: "document" | "distance";
1759
+ origin?: {
1760
+ x: number;
1761
+ y: number;
1762
+ };
1669
1763
  index: number;
1670
1764
  } | {
1671
1765
  flairPrimitive?: string | undefined;
@@ -1808,6 +1902,24 @@ declare function describeMotionShots(scene: MotionScene): {
1808
1902
  repeatMode?: "loop" | "mirror" | "offset";
1809
1903
  steps?: number;
1810
1904
  index: number;
1905
+ } | {
1906
+ flairPrimitive?: string | undefined;
1907
+ start: number;
1908
+ end: number;
1909
+ type: "play";
1910
+ clip: string;
1911
+ speed?: number;
1912
+ targets: string[];
1913
+ duration?: number;
1914
+ delay?: number;
1915
+ stagger?: number;
1916
+ with?: "after" | "previous";
1917
+ ease?: AnimationEasing;
1918
+ note?: string;
1919
+ repeat?: number;
1920
+ repeatMode?: "loop" | "mirror" | "offset";
1921
+ steps?: number;
1922
+ index: number;
1811
1923
  } | {
1812
1924
  flairPrimitive?: string | undefined;
1813
1925
  start: number;
@@ -1997,7 +2109,7 @@ declare function createAnimationEditorToolProvider(controller: AnimationEditorCo
1997
2109
  * A short authoring guide for a model writing vector animations with the animation editor's
1998
2110
  * tools. Static, so it caches well as part of a system prompt.
1999
2111
  */
2000
- 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- 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.";
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.";
2001
2113
 
2002
2114
  /**
2003
2115
  * Helpers for hand-editing UIs (React's and Svelte's command inspector, ease picker, cue picker,
@@ -2144,4 +2256,4 @@ declare function parseMotionNarration(text: string): {
2144
2256
  error: string;
2145
2257
  };
2146
2258
 
2147
- 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_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 MotionClipShape, type MotionColorPulseCommand, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionControl, type MotionCue, type MotionDirection, type MotionDrawCommand, 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 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, 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, 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 };
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 };
@@ -51,6 +51,11 @@ interface MotionScene {
51
51
  narration?: MotionNarration;
52
52
  /** Wanted length in seconds `[min, max]`; `check` warns outside it. */
53
53
  target?: [number, number];
54
+ /**
55
+ * Reusable motion: named command lists written against the target `"$"`, played on any
56
+ * node with a `play` command (a "pop and settle" or "attention" you use many times).
57
+ */
58
+ clips?: Record<string, MotionClip>;
54
59
  /** Parameters a Flair effect made from this scene exposes (see `toFlairVectorEffect`). */
55
60
  controls?: MotionControl[];
56
61
  /** Named sets of control values. */
@@ -169,7 +174,7 @@ type MotionSplitOrientation = 'horizontal' | 'vertical';
169
174
  * Brings hidden targets in. Targets entered in a shot are hidden before it. Each style is a
170
175
  * Flair motion primitive (`entrance.<style>`) with the same defaults.
171
176
  */
172
- interface MotionEnterCommand extends MotionCommandBase {
177
+ interface MotionEnterCommand extends MotionCommandBase, MotionDrawOrder {
173
178
  type: 'enter';
174
179
  /**
175
180
  * Default `fade`. `draw` draws the outline on, then fades the fill in. `pop` scales up past
@@ -193,7 +198,7 @@ interface MotionEnterCommand extends MotionCommandBase {
193
198
  orientation?: MotionSplitOrientation;
194
199
  }
195
200
  /** Takes targets out. */
196
- interface MotionExitCommand extends MotionCommandBase {
201
+ interface MotionExitCommand extends MotionCommandBase, MotionDrawOrder {
197
202
  type: 'exit';
198
203
  /** Default `fade`. `wipe` hides the target behind an edge travelling `direction` (a wipe in, reversed). */
199
204
  style?: MotionExitStyle;
@@ -201,9 +206,33 @@ interface MotionExitCommand extends MotionCommandBase {
201
206
  direction?: MotionDirection;
202
207
  distance?: number;
203
208
  }
209
+ /**
210
+ * How the strokes of a group (or several paths) draw on or off together. Default: all at once,
211
+ * each over the whole time.
212
+ */
213
+ interface MotionDrawOrder {
214
+ /** `together` (default) or `sequence`: one stroke after another, each for a time in proportion to its length. */
215
+ order?: 'together' | 'sequence';
216
+ /** With `together`: `time` (default) gives every stroke the whole time; `speed` draws them all at one speed, so short ones take less. */
217
+ pace?: 'time' | 'speed';
218
+ /** With `pace: "speed"`: `start` (default) starts them together, `end` finishes them together. */
219
+ align?: 'start' | 'end';
220
+ /** With `sequence`: `document` (default, stacking order) or `distance` from `origin` (a radial reveal). */
221
+ sortBy?: 'document' | 'distance';
222
+ /** With `sortBy: "distance"`: the point (document units) strokes are drawn out from (default the target's centre). */
223
+ origin?: {
224
+ x: number;
225
+ y: number;
226
+ };
227
+ }
204
228
  /** Draws a stroke on (or off) between two fractions of its length. */
205
- interface MotionDrawCommand extends MotionCommandBase {
229
+ interface MotionDrawCommand extends MotionCommandBase, MotionDrawOrder {
206
230
  type: 'draw';
231
+ /**
232
+ * A travelling stroke this fraction of the length long (0–1): it runs along the path and off
233
+ * the end, instead of drawing it on and leaving it.
234
+ */
235
+ comet?: number;
207
236
  /** Fraction drawn at the end (default 1). */
208
237
  to?: number;
209
238
  /** Fraction drawn at the start (default: what is drawn now). */
@@ -296,6 +325,22 @@ interface MotionMatchCommand extends MotionCommandBase {
296
325
  /** Id of the group (or node) to become. */
297
326
  into: string;
298
327
  }
328
+ /** A reusable piece of motion: commands that target `"$"` (whatever `play` names), timed as in a shot. */
329
+ interface MotionClip {
330
+ description?: string;
331
+ /** Commands, timed as in a shot; `"$"` in `targets` stands for the node played on. Clips cannot play clips. */
332
+ run: MotionCommand[];
333
+ }
334
+ /** The placeholder target in a clip's commands. */
335
+ declare const MOTION_CLIP_TARGET = "$";
336
+ /** Plays a clip (`scene.clips`) on the targets: its commands, with `"$"` standing for each target. */
337
+ interface MotionPlayCommand extends MotionCommandBase {
338
+ type: 'play';
339
+ /** The clip's name. */
340
+ clip: string;
341
+ /** Play it this many times as fast (default 1). */
342
+ speed?: number;
343
+ }
299
344
  /** Moves targets along a path node, centre on the path. */
300
345
  interface MotionFollowCommand extends MotionCommandBase {
301
346
  type: 'follow';
@@ -419,7 +464,7 @@ interface MotionWaitCommand {
419
464
  with?: 'after' | 'previous';
420
465
  note?: string;
421
466
  }
422
- type MotionCommand = MotionEnterCommand | MotionExitCommand | MotionDrawCommand | MotionMoveCommand | MotionRotateCommand | MotionScaleCommand | MotionFadeCommand | MotionStyleCommand | MotionMorphCommand | MotionMatchCommand | MotionFollowCommand | MotionPulseCommand | MotionShakeCommand | MotionTeeterCommand | MotionWaveCommand | MotionWiggleCommand | MotionColorPulseCommand | MotionEffectCommand | MotionWaitCommand;
467
+ type MotionCommand = MotionEnterCommand | MotionExitCommand | MotionDrawCommand | MotionMoveCommand | MotionRotateCommand | MotionScaleCommand | MotionFadeCommand | MotionStyleCommand | MotionMorphCommand | MotionMatchCommand | MotionPlayCommand | MotionFollowCommand | MotionPulseCommand | MotionShakeCommand | MotionTeeterCommand | MotionWaveCommand | MotionWiggleCommand | MotionColorPulseCommand | MotionEffectCommand | MotionWaitCommand;
423
468
  type MotionCommandType = MotionCommand['type'];
424
469
  declare const MOTION_COMMAND_TYPES: readonly MotionCommandType[];
425
470
  declare const MOTION_ENTER_STYLES: readonly MotionEnterStyle[];
@@ -494,6 +539,10 @@ declare const MOTION_ISSUE_CODES: {
494
539
  readonly severity: "warning";
495
540
  readonly wording: "A wipe, iris or split cannot clip a node with no width or height (a lone straight line), so it fades instead.";
496
541
  };
542
+ readonly 'unknown-clip': {
543
+ readonly severity: "error";
544
+ readonly wording: "A play command names a clip the scene does not have.";
545
+ };
497
546
  readonly 'unknown-shape': {
498
547
  readonly severity: "error";
499
548
  readonly wording: "A morph names a shape the artwork does not have.";
@@ -631,6 +680,8 @@ declare class MotionSceneFormatError extends Error {
631
680
  }
632
681
  /** Problems with one command's shape (empty when well formed). `where` prefixes each. */
633
682
  declare function commandShapeProblems(command: unknown, where: string): string[];
683
+ /** Problems with a scene's `clips`: names, and each clip's commands (which may target `"$"` but not play clips). */
684
+ declare function clipsShapeProblems(clips: unknown): string[];
634
685
  /** Problems with one shot's shape. */
635
686
  declare function shotShapeProblems(shot: unknown, where: string): string[];
636
687
  /** Problems with a scene's shape (empty when well formed). */
@@ -832,6 +883,20 @@ declare function motionCueTime(scene: Pick<MotionScene, 'beat' | 'narration'>, c
832
883
  declare function motionCommandRepeat(command: MotionCommand): number;
833
884
  /** How long one target of a command takes (ms), every repeat included. */
834
885
  declare function motionCommandDuration(command: MotionCommand, scene: MotionScene, target?: string): number;
886
+ /** One command of a clip played on a target: when it starts (ms from the play's start), its target and one cycle's length. */
887
+ interface MotionClipItem {
888
+ command: Exclude<MotionCommand, {
889
+ type: 'wait';
890
+ }>;
891
+ target: string;
892
+ start: number;
893
+ cycle: number;
894
+ }
895
+ /** A clip's commands for `target` (`"$"` replaced), timed as in a shot from 0 at `speed`; unknown clips give nothing. */
896
+ declare function motionClipLayout(scene: MotionScene, clip: string, target: string, speed?: number): {
897
+ items: MotionClipItem[];
898
+ length: number;
899
+ };
835
900
  /** How long one cycle of a command takes for one target (ms): its `duration`, a spring's settle time, the line's length for a draw, or the type's default. */
836
901
  declare function motionCycleDuration(command: MotionCommand, scene: MotionScene, target?: string): number;
837
902
  /** Cubic ease-out, `1 − (1 − t)³` exactly (Flair's `out`): the default for things arriving. */
@@ -1105,6 +1170,10 @@ type MotionEdit = {
1105
1170
  op: 'set_controls';
1106
1171
  controls: MotionControl[];
1107
1172
  presets?: MotionPreset[];
1173
+ } | {
1174
+ op: 'set_clip';
1175
+ name: string;
1176
+ clip: MotionClip | null;
1108
1177
  } | {
1109
1178
  op: 'replace_scene';
1110
1179
  scene: MotionScene;
@@ -1629,6 +1698,14 @@ declare function describeMotionShots(scene: MotionScene): {
1629
1698
  repeat?: number;
1630
1699
  repeatMode?: "loop" | "mirror" | "offset";
1631
1700
  steps?: number;
1701
+ order?: "together" | "sequence";
1702
+ pace?: "time" | "speed";
1703
+ align?: "start" | "end";
1704
+ sortBy?: "document" | "distance";
1705
+ origin?: {
1706
+ x: number;
1707
+ y: number;
1708
+ };
1632
1709
  index: number;
1633
1710
  } | {
1634
1711
  flairPrimitive?: string | undefined;
@@ -1648,12 +1725,21 @@ declare function describeMotionShots(scene: MotionScene): {
1648
1725
  repeat?: number;
1649
1726
  repeatMode?: "loop" | "mirror" | "offset";
1650
1727
  steps?: number;
1728
+ order?: "together" | "sequence";
1729
+ pace?: "time" | "speed";
1730
+ align?: "start" | "end";
1731
+ sortBy?: "document" | "distance";
1732
+ origin?: {
1733
+ x: number;
1734
+ y: number;
1735
+ };
1651
1736
  index: number;
1652
1737
  } | {
1653
1738
  flairPrimitive?: string | undefined;
1654
1739
  start: number;
1655
1740
  end: number;
1656
1741
  type: "draw";
1742
+ comet?: number;
1657
1743
  to?: number;
1658
1744
  from?: number;
1659
1745
  targets: string[];
@@ -1666,6 +1752,14 @@ declare function describeMotionShots(scene: MotionScene): {
1666
1752
  repeat?: number;
1667
1753
  repeatMode?: "loop" | "mirror" | "offset";
1668
1754
  steps?: number;
1755
+ order?: "together" | "sequence";
1756
+ pace?: "time" | "speed";
1757
+ align?: "start" | "end";
1758
+ sortBy?: "document" | "distance";
1759
+ origin?: {
1760
+ x: number;
1761
+ y: number;
1762
+ };
1669
1763
  index: number;
1670
1764
  } | {
1671
1765
  flairPrimitive?: string | undefined;
@@ -1808,6 +1902,24 @@ declare function describeMotionShots(scene: MotionScene): {
1808
1902
  repeatMode?: "loop" | "mirror" | "offset";
1809
1903
  steps?: number;
1810
1904
  index: number;
1905
+ } | {
1906
+ flairPrimitive?: string | undefined;
1907
+ start: number;
1908
+ end: number;
1909
+ type: "play";
1910
+ clip: string;
1911
+ speed?: number;
1912
+ targets: string[];
1913
+ duration?: number;
1914
+ delay?: number;
1915
+ stagger?: number;
1916
+ with?: "after" | "previous";
1917
+ ease?: AnimationEasing;
1918
+ note?: string;
1919
+ repeat?: number;
1920
+ repeatMode?: "loop" | "mirror" | "offset";
1921
+ steps?: number;
1922
+ index: number;
1811
1923
  } | {
1812
1924
  flairPrimitive?: string | undefined;
1813
1925
  start: number;
@@ -1997,7 +2109,7 @@ declare function createAnimationEditorToolProvider(controller: AnimationEditorCo
1997
2109
  * A short authoring guide for a model writing vector animations with the animation editor's
1998
2110
  * tools. Static, so it caches well as part of a system prompt.
1999
2111
  */
2000
- 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- 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.";
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.";
2001
2113
 
2002
2114
  /**
2003
2115
  * Helpers for hand-editing UIs (React's and Svelte's command inspector, ease picker, cue picker,
@@ -2144,4 +2256,4 @@ declare function parseMotionNarration(text: string): {
2144
2256
  error: string;
2145
2257
  };
2146
2258
 
2147
- 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_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 MotionClipShape, type MotionColorPulseCommand, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionControl, type MotionCue, type MotionDirection, type MotionDrawCommand, 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 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, 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, 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 };
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 };