@pixerate/editor 0.124.0 → 0.125.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.
Files changed (92) hide show
  1. package/dist/agent/index.cjs +3 -3
  2. package/dist/agent/index.cjs.map +1 -1
  3. package/dist/agent/index.js +3 -3
  4. package/dist/animation-editor/index.cjs +424 -85
  5. package/dist/animation-editor/index.cjs.map +1 -1
  6. package/dist/animation-editor/index.d.cts +174 -7
  7. package/dist/animation-editor/index.d.ts +174 -7
  8. package/dist/animation-editor/index.js +348 -9
  9. package/dist/animation-editor/index.js.map +1 -1
  10. package/dist/chunk-FJ3324TZ.js +59 -0
  11. package/dist/chunk-FJ3324TZ.js.map +1 -0
  12. package/dist/{chunk-5EO2IXQE.js → chunk-FPRIUR4T.js} +1 -1
  13. package/dist/chunk-FPRIUR4T.js.map +1 -0
  14. package/dist/{chunk-YVVSTD3B.js → chunk-G6WXWS4Y.js} +9 -18
  15. package/dist/chunk-G6WXWS4Y.js.map +1 -0
  16. package/dist/{chunk-NGYD3AMN.js → chunk-MPQAO33O.js} +2 -2
  17. package/dist/{chunk-PEHYWUVV.cjs → chunk-O5RVCDEC.cjs} +82 -82
  18. package/dist/{chunk-PEHYWUVV.cjs.map → chunk-O5RVCDEC.cjs.map} +1 -1
  19. package/dist/{chunk-TK53AB4Q.cjs → chunk-QDJKUBWE.cjs} +3 -3
  20. package/dist/{chunk-TK53AB4Q.cjs.map → chunk-QDJKUBWE.cjs.map} +1 -1
  21. package/dist/{chunk-5XXMLBH4.cjs → chunk-QQKTOA4U.cjs} +1 -1
  22. package/dist/chunk-QQKTOA4U.cjs.map +1 -0
  23. package/dist/{chunk-IWSMDQE5.cjs → chunk-UXFI3CDZ.cjs} +13 -22
  24. package/dist/chunk-UXFI3CDZ.cjs.map +1 -0
  25. package/dist/{chunk-WE25VLCO.cjs → chunk-V5YGPRCZ.cjs} +36 -36
  26. package/dist/{chunk-WE25VLCO.cjs.map → chunk-V5YGPRCZ.cjs.map} +1 -1
  27. package/dist/chunk-W6QTLHZ3.cjs +59 -0
  28. package/dist/chunk-W6QTLHZ3.cjs.map +1 -0
  29. package/dist/{chunk-WATAQ2Z2.js → chunk-WUDPFWAN.js} +2 -2
  30. package/dist/{chunk-VFAKN46Z.js → chunk-XZWOLXWA.js} +3 -3
  31. package/dist/{chunk-VFAKN46Z.js.map → chunk-XZWOLXWA.js.map} +1 -1
  32. package/dist/effects/index.cjs +51 -6
  33. package/dist/effects/index.cjs.map +1 -1
  34. package/dist/effects/index.d.cts +39 -8
  35. package/dist/effects/index.d.ts +39 -8
  36. package/dist/effects/index.js +48 -3
  37. package/dist/effects/index.js.map +1 -1
  38. package/dist/{export-TqXMOlDt.d.cts → export-Bp7ji2r4.d.cts} +4 -3
  39. package/dist/{export-BzSRXyH6.d.cts → export-C1s4eolZ.d.ts} +5 -3
  40. package/dist/{export-8RnlngAv.d.ts → export-DAyPY94f.d.ts} +4 -3
  41. package/dist/{export-DM3h7QEI.d.ts → export-DVl4fWy5.d.cts} +5 -3
  42. package/dist/generation/index.cjs +3 -3
  43. package/dist/generation/index.cjs.map +1 -1
  44. package/dist/generation/index.js +3 -3
  45. package/dist/helpers-BBLlekuM.d.ts +2009 -0
  46. package/dist/helpers-i95Ob6Vi.d.cts +2009 -0
  47. package/dist/image-editor/index.cjs +712 -721
  48. package/dist/image-editor/index.cjs.map +1 -1
  49. package/dist/image-editor/index.d.cts +5 -7
  50. package/dist/image-editor/index.d.ts +5 -7
  51. package/dist/image-editor/index.js +19 -28
  52. package/dist/image-editor/index.js.map +1 -1
  53. package/dist/paint-editor/index.cjs +12 -11
  54. package/dist/paint-editor/index.cjs.map +1 -1
  55. package/dist/paint-editor/index.d.cts +3 -5
  56. package/dist/paint-editor/index.d.ts +3 -5
  57. package/dist/paint-editor/index.js +6 -5
  58. package/dist/paint-editor/index.js.map +1 -1
  59. package/dist/{svg-BDrjRnL1.d.cts → svg-BkRL-fZJ.d.cts} +1 -1
  60. package/dist/{svg-C-vZ3q50.d.ts → svg-DJKriJ4A.d.ts} +1 -1
  61. package/dist/tools/index.cjs +2 -2
  62. package/dist/tools/index.cjs.map +1 -1
  63. package/dist/tools/index.js +3 -3
  64. package/dist/{tools-C7JtLYzo.d.ts → tools-CM8Oe8F3.d.ts} +1 -1
  65. package/dist/{tools-DHKGHiSK.d.cts → tools-DZCv2kX1.d.cts} +1 -1
  66. package/dist/vector/index.cjs +1032 -883
  67. package/dist/vector/index.cjs.map +1 -1
  68. package/dist/vector/index.d.cts +61 -6
  69. package/dist/vector/index.d.ts +61 -6
  70. package/dist/vector/index.js +155 -6
  71. package/dist/vector/index.js.map +1 -1
  72. package/dist/video-editor/index.cjs +271 -270
  73. package/dist/video-editor/index.cjs.map +1 -1
  74. package/dist/video-editor/index.d.cts +4 -6
  75. package/dist/video-editor/index.d.ts +4 -6
  76. package/dist/video-editor/index.js +6 -5
  77. package/dist/video-editor/index.js.map +1 -1
  78. package/package.json +1 -1
  79. package/skills/pixerate-animation-editor/SKILL.md +24 -1
  80. package/skills/pixerate-vector/SKILL.md +15 -0
  81. package/dist/chunk-5EO2IXQE.js.map +0 -1
  82. package/dist/chunk-5XXMLBH4.cjs.map +0 -1
  83. package/dist/chunk-IWSMDQE5.cjs.map +0 -1
  84. package/dist/chunk-YVVSTD3B.js.map +0 -1
  85. package/dist/flair-CxB3fOcU.d.ts +0 -739
  86. package/dist/flair-D7BxyBwL.d.cts +0 -739
  87. package/dist/helpers-777mC6dc.d.cts +0 -253
  88. package/dist/helpers-DX2_7L5t.d.ts +0 -253
  89. package/dist/types-BcX7sCsn.d.ts +0 -993
  90. package/dist/types-CznabG7m.d.cts +0 -993
  91. /package/dist/{chunk-NGYD3AMN.js.map → chunk-MPQAO33O.js.map} +0 -0
  92. /package/dist/{chunk-WATAQ2Z2.js.map → chunk-WUDPFWAN.js.map} +0 -0
@@ -1,739 +0,0 @@
1
- import { a as MotionBehavior } from './behavior-Ymbld6jL.js';
2
- import { b as AnimationEasing } from './easing-lM0Xo9Ni.js';
3
- import { b as AnimationLoopMode } from './evaluate-CfmT6xA3.js';
4
- import { V as VectorDocument } from './types-BcX7sCsn.js';
5
-
6
- /**
7
- * A vector animation as plain JSON: a piece of vector artwork (the editor's `VectorDocument`,
8
- * as the vector editor draws it) and the shots that bring it to life.
9
- *
10
- * Shots, not timelines: a shot frames the camera, plays its commands and holds. Timing comes
11
- * from the content (each command has a sensible default length, and drawing a line takes as
12
- * long as the line is long), so there are no keyframes to manage. The same scene plays the
13
- * same frames every time: every frame is a pure function of time.
14
- */
15
- interface MotionScene {
16
- /** Format version (always 1). */
17
- version: 1;
18
- /** A short name, e.g. `logo-reveal`. */
19
- name: string;
20
- description?: string;
21
- /** The artwork in its resting state. Commands target its node ids. */
22
- artwork: VectorDocument;
23
- shots: MotionShot[];
24
- /** Playback past the end: stop (`none`, default), `loop` or `ping-pong`. */
25
- loop?: AnimationLoopMode;
26
- /**
27
- * Plays in answer to the viewer instead of on its own (exported to Flair's player):
28
- * - `click`: nothing plays until the viewer clicks; each click plays the next shot, and after the
29
- * last one a click plays the first again, so a last shot that puts things back makes a toggle.
30
- * - `hover` / `press`: plays forward while the pointer is over (or down on) it, and back when it leaves.
31
- * - `scroll`: scrubs through the scene as it scrolls through the viewport.
32
- * The editor previews it played through; `loop` does not apply.
33
- */
34
- trigger?: MotionTrigger;
35
- /** Frame rate used to sample motion that a target format cannot express exactly (default 30). */
36
- fps?: number;
37
- /**
38
- * Stepped time for every command that gives none: changes hold on a grid of this many frames
39
- * per second ("on twos" at 12), for a hand-drawn look. Default: smooth.
40
- */
41
- steps?: number;
42
- /** A beat grid to cue shots to (`MotionShot.at.beat`): music or a voiceover's rhythm. */
43
- beat?: MotionBeatGrid;
44
- /** A voiceover's words with their times, to cue shots to (`MotionShot.at.word`). */
45
- narration?: MotionNarration;
46
- /** Wanted length in seconds `[min, max]`; `check` warns outside it. */
47
- target?: [number, number];
48
- /**
49
- * Reusable motion: named command lists written against the target `"$"`, played on any
50
- * node with a `play` command (a "pop and settle" or "attention" you use many times).
51
- */
52
- clips?: Record<string, MotionClip>;
53
- /**
54
- * Properties that follow other properties: a background moving at half the speed of the
55
- * foreground (parallax), a wheel turning as it rolls. Each adds to what its target's commands do.
56
- */
57
- drivers?: MotionDriver[];
58
- /**
59
- * Motion blur on the stage and in rendered frames (not in exports): each frame averages a few
60
- * moments across the shutter, more for faster motion.
61
- */
62
- motionBlur?: MotionBlur;
63
- /** Parameters a Flair effect made from this scene exposes (see `toFlairVectorEffect`). */
64
- controls?: MotionControl[];
65
- /** Named sets of control values. */
66
- presets?: MotionPreset[];
67
- }
68
- /** What the viewer does to play a triggered scene (see `MotionScene.trigger`). */
69
- type MotionTrigger = 'click' | 'hover' | 'press' | 'scroll';
70
- declare const MOTION_TRIGGERS: readonly MotionTrigger[];
71
- /** A rectangle of the artwork, in document units. */
72
- interface MotionRect {
73
- x: number;
74
- y: number;
75
- width: number;
76
- height: number;
77
- }
78
- /**
79
- * Where the camera looks: a rectangle, or the id of a node to frame (with `padding` around
80
- * its bounds, default 24). The camera eases there over `ms` (default 1000; the first shot cuts).
81
- */
82
- type MotionCamera = (MotionRect | {
83
- frame: string;
84
- padding?: number;
85
- }) & {
86
- ease?: AnimationEasing;
87
- ms?: number;
88
- /** Zoom at a steady rate (the size changes by the same factor each moment) instead of linearly. */
89
- geometric?: boolean;
90
- };
91
- /** A steady beat: `bpm` beats a minute, the first at `offset` ms, `meter` beats a bar. */
92
- interface MotionBeatGrid {
93
- bpm: number;
94
- /** When beat 0 falls, ms (default 0). */
95
- offset?: number;
96
- /** Beats in a bar (default 4), for reading beats as bar and beat. */
97
- meter?: number;
98
- }
99
- /** A voiceover: its words in order, each with when it is said (ms), from a TTS or speech-to-text word timing. */
100
- interface MotionNarration {
101
- words: {
102
- text: string;
103
- start: number;
104
- end?: number;
105
- }[];
106
- }
107
- /** When a shot is cued to start: on a beat, on a narration word, or at a time. */
108
- interface MotionCue {
109
- /** Beat number on the scene's beat grid, from 0 (fractions for off-beats: 2.5 is the "and" of beat 3). */
110
- beat?: number;
111
- /** Index of a word in the scene's narration, from 0. */
112
- word?: number;
113
- /** A time in ms. */
114
- ms?: number;
115
- }
116
- /** One beat of the animation. */
117
- interface MotionShot {
118
- /** Stable id (unique in the scene), e.g. `intro`. */
119
- id: string;
120
- /** What happens in this shot, in a few words (shown on the timeline). */
121
- label?: string;
122
- /** Omit to keep the current framing. */
123
- camera?: MotionCamera;
124
- /**
125
- * Start on a cue: a beat, a narration word or a time. The shot before holds until then; a
126
- * cue that comes before the shot before has ended is missed (`check` says by how much).
127
- * Give one of `beat`, `word` or `ms`.
128
- */
129
- at?: MotionCue;
130
- /** Commands, played one after another (unless a command says `with: "previous"`). */
131
- run: MotionCommand[];
132
- /** Milliseconds to hold after the commands finish (default 600). */
133
- hold?: number;
134
- /**
135
- * Plays the whole shot this many times as fast (default 1): its camera move, delays,
136
- * durations, staggers and hold all scale by 1 / speed. `fit_animation` sets it to fit a length.
137
- */
138
- speed?: number;
139
- }
140
- /** How `split` splits outlined text. */
141
- type MotionTextUnit = 'letter' | 'word' | 'line';
142
- declare const MOTION_TEXT_UNITS: readonly MotionTextUnit[];
143
- /** The order `split` units animate in. */
144
- type MotionCascade = 'forward' | 'backward' | 'center' | 'edges' | 'random';
145
- declare const MOTION_CASCADES: readonly MotionCascade[];
146
- /** Fields every command takes. */
147
- interface MotionCommandBase {
148
- /** Node ids from the artwork (groups animate as one, unless `split` splits their text). */
149
- targets: string[];
150
- /**
151
- * For outlined text (a group of letter paths): animate it a letter, word or line at a time,
152
- * staggered in reading order (default stagger 40 ms a letter, 120 a word, 300 a line).
153
- */
154
- split?: MotionTextUnit;
155
- /** With `split`: the order units go in (default `forward`). `random` is the same every time. */
156
- cascade?: MotionCascade;
157
- /** Length in ms for each target, one cycle when repeating (each type has a default; `draw` follows the path length; a spring `ease` lasts until it settles). */
158
- duration?: number;
159
- /** Wait this many ms before starting (default 0). */
160
- delay?: number;
161
- /** Start each further target this many ms after the one before (default 0). */
162
- stagger?: number;
163
- /** `after` (default) starts when the commands before it finish; `previous` starts with the command before. */
164
- with?: 'after' | 'previous';
165
- /** An easing; a spring with no `duration` lasts until it settles. */
166
- ease?: AnimationEasing;
167
- /** Why this command is here (for people and agents reading the scene). */
168
- note?: string;
169
- /**
170
- * Play the change this many times (a whole number, default 1); `duration` is one cycle. Not
171
- * for `enter`, `exit` or `wait`.
172
- */
173
- repeat?: number;
174
- /**
175
- * How repeats follow each other: `loop` (default) starts each cycle afresh, `mirror` plays
176
- * every other one backwards, `offset` carries on from where the last ended (rotate by 90,
177
- * repeat 4: a full turn). Colours and shapes offset like `loop`.
178
- */
179
- repeatMode?: 'loop' | 'mirror' | 'offset';
180
- /** Stepped time: hold the change on a grid of this many frames per second (default: the scene's `steps`, else smooth). */
181
- steps?: number;
182
- }
183
- type MotionEnterStyle = 'fade' | 'pop' | 'grow' | 'slide' | 'draw' | 'zoom' | 'rise' | 'wipe' | 'iris' | 'split';
184
- type MotionExitStyle = 'fade' | 'shrink' | 'slide' | 'undraw' | 'wipe';
185
- type MotionDirection = 'up' | 'down' | 'left' | 'right';
186
- /** The opening an `iris` reveals through. */
187
- type MotionIrisShape = 'circle' | 'box';
188
- /** The line a `split` opens from. */
189
- type MotionSplitOrientation = 'horizontal' | 'vertical';
190
- /**
191
- * Brings hidden targets in. Targets entered in a shot are hidden before it. Each style is a
192
- * Flair motion primitive (`entrance.<style>`) with the same defaults.
193
- */
194
- interface MotionEnterCommand extends MotionCommandBase, MotionDrawOrder {
195
- type: 'enter';
196
- /**
197
- * Default `fade`. `draw` draws the outline on, then fades the fill in. `pop` scales up past
198
- * full size and settles; `zoom` settles from larger; `rise` rises a short way with a little
199
- * overshoot. `wipe`, `iris` and `split` reveal the target through a clip over its box (see
200
- * `MotionFrame.clips`), reaching past it far enough to show its whole stroke.
201
- */
202
- style?: MotionEnterStyle;
203
- /**
204
- * For `slide`: the direction of travel (default `up`). For `wipe`: the way the edge travels
205
- * (default `right`, which reveals from the left).
206
- */
207
- direction?: MotionDirection;
208
- /** For `slide` (default 40) and `rise` (default 20): how far in document units. */
209
- distance?: number;
210
- /** For `pop` (default 0.5) and `zoom` (default 1.6): the starting scale. */
211
- scale?: number;
212
- /** For `iris`: open through a `circle` (default; an ellipse on a box that is not square) or a `box`. */
213
- shape?: MotionIrisShape;
214
- /** For `split`: open up and down from a `horizontal` line through the middle (default), or left and right from a `vertical` one. */
215
- orientation?: MotionSplitOrientation;
216
- }
217
- /** Takes targets out. */
218
- interface MotionExitCommand extends MotionCommandBase, MotionDrawOrder {
219
- type: 'exit';
220
- /** Default `fade`. `wipe` hides the target behind an edge travelling `direction` (a wipe in, reversed). */
221
- style?: MotionExitStyle;
222
- /** For `slide`: the direction of travel (default `down`). For `wipe`: the way the edge travels (default `right`, which hides from the left). */
223
- direction?: MotionDirection;
224
- distance?: number;
225
- }
226
- /**
227
- * How the strokes of a group (or several paths) draw on or off together. Default: all at once,
228
- * each over the whole time.
229
- */
230
- interface MotionDrawOrder {
231
- /** `together` (default) or `sequence`: one stroke after another, each for a time in proportion to its length. */
232
- order?: 'together' | 'sequence';
233
- /** With `together`: `time` (default) gives every stroke the whole time; `speed` draws them all at one speed, so short ones take less. */
234
- pace?: 'time' | 'speed';
235
- /** With `pace: "speed"`: `start` (default) starts them together, `end` finishes them together. */
236
- align?: 'start' | 'end';
237
- /** With `sequence`: `document` (default, stacking order) or `distance` from `origin` (a radial reveal). */
238
- sortBy?: 'document' | 'distance';
239
- /** With `sortBy: "distance"`: the point (document units) strokes are drawn out from (default the target's centre). */
240
- origin?: {
241
- x: number;
242
- y: number;
243
- };
244
- }
245
- /** Draws a stroke on (or off) between two fractions of its length. */
246
- interface MotionDrawCommand extends MotionCommandBase, MotionDrawOrder {
247
- type: 'draw';
248
- /**
249
- * A travelling stroke this fraction of the length long (0–1): it runs along the path and off
250
- * the end, instead of drawing it on and leaving it.
251
- */
252
- comet?: number;
253
- /** Fraction drawn at the end (default 1). */
254
- to?: number;
255
- /** Fraction drawn at the start (default: what is drawn now). */
256
- from?: number;
257
- }
258
- /** Moves targets by an offset, or to a point (their centre lands there). */
259
- interface MotionMoveCommand extends MotionCommandBase {
260
- /**
261
- * `add` makes the change a layer over the pose instead of a change to it: it stacks on
262
- * whatever else moves the target (a shake on a slide), and what it adds stays once it ends.
263
- * Default `replace` for move, rotate and scale (the later change takes over), `add` for
264
- * pulse, shake, teeter, wave and wiggle.
265
- */
266
- blend?: 'replace' | 'add';
267
- type: 'move';
268
- by?: {
269
- x: number;
270
- y: number;
271
- };
272
- to?: {
273
- x: number;
274
- y: number;
275
- };
276
- /**
277
- * Points (document units) the centre passes through on the way, in order. The path is
278
- * smooth (velocity carries through each point) and never overshoots a point.
279
- */
280
- via?: {
281
- x: number;
282
- y: number;
283
- }[];
284
- /** With `via`: `even` (default) keeps the speed steady along the path, `equal` gives each leg the same time. */
285
- pacing?: 'even' | 'equal';
286
- }
287
- /** Turns targets about their centre, by or to an angle in degrees (clockwise). */
288
- interface MotionRotateCommand extends MotionCommandBase {
289
- /**
290
- * `add` makes the change a layer over the pose instead of a change to it: it stacks on
291
- * whatever else moves the target (a shake on a slide), and what it adds stays once it ends.
292
- * Default `replace` for move, rotate and scale (the later change takes over), `add` for
293
- * pulse, shake, teeter, wave and wiggle.
294
- */
295
- blend?: 'replace' | 'add';
296
- type: 'rotate';
297
- by?: number;
298
- to?: number;
299
- }
300
- /** Scales targets about their centre (1 = rest size). */
301
- interface MotionScaleCommand extends MotionCommandBase {
302
- /**
303
- * `add` makes the change a layer over the pose instead of a change to it: it stacks on
304
- * whatever else moves the target (a shake on a slide), and what it adds stays once it ends.
305
- * Default `replace` for move, rotate and scale (the later change takes over), `add` for
306
- * pulse, shake, teeter, wave and wiggle.
307
- */
308
- blend?: 'replace' | 'add';
309
- type: 'scale';
310
- to: number | {
311
- x: number;
312
- y: number;
313
- };
314
- /** Grow at a steady rate (the same factor each moment), which reads as an even zoom. */
315
- geometric?: boolean;
316
- }
317
- /** Changes opacity (0–1). */
318
- interface MotionFadeCommand extends MotionCommandBase {
319
- type: 'fade';
320
- to: number;
321
- }
322
- /** Changes solid paints and stroke width. Colours mix in OKLab. */
323
- interface MotionStyleCommand extends MotionCommandBase {
324
- type: 'style';
325
- fill?: string;
326
- stroke?: string;
327
- strokeWidth?: number;
328
- }
329
- /** Morphs each target into the shape of another node (`into`), which usually stays hidden. */
330
- interface MotionMorphCommand extends MotionCommandBase {
331
- type: 'morph';
332
- into: string;
333
- }
334
- /**
335
- * Smart Animate: tweens a group into another group (`into`, usually hidden), part by part. Each
336
- * part of the target takes the shape, paint and place of its partner in `into`, paired by name,
337
- * then by id (`card-a-title` ↔ `card-b-title`), then by kind in order. Parts with no partner fade
338
- * out; parts of `into` with no partner do not appear (`check` lists them).
339
- */
340
- interface MotionMatchCommand extends MotionCommandBase {
341
- type: 'match';
342
- /** Id of the group (or node) to become. */
343
- into: string;
344
- }
345
- /** A reusable piece of motion: commands that target `"$"` (whatever `play` names), timed as in a shot. */
346
- interface MotionClip {
347
- description?: string;
348
- /** Commands, timed as in a shot; `"$"` in `targets` stands for the node played on. Clips cannot play clips. */
349
- run: MotionCommand[];
350
- }
351
- /** Motion blur: how long the shutter is open and how many moments a frame averages at most. */
352
- interface MotionBlur {
353
- /** Shutter angle in degrees of a frame at the scene's fps (default 180: half a frame; 360 is a whole frame). */
354
- shutter?: number;
355
- /** Most moments a frame averages (default 8, at most 32); fewer for slower motion. */
356
- samples?: number;
357
- }
358
- /** Properties a driver reads and drives: offsets (document units), turn (degrees), scales and opacity. */
359
- type MotionDrivenProperty = 'x' | 'y' | 'rotation' | 'scaleX' | 'scaleY' | 'opacity';
360
- declare const MOTION_DRIVEN_PROPERTIES: readonly MotionDrivenProperty[];
361
- /**
362
- * One property following another. Both are read as a change from rest (offsets and turns from
363
- * 0, scales and opacity from 1): the target's property changes by `source change · factor + offset`,
364
- * clamped to `clamp`, on top of its own commands (added to offsets and turns, multiplied into
365
- * scales and opacity as 1 + change).
366
- */
367
- interface MotionDriver {
368
- /** The node that follows. */
369
- target: string;
370
- property: MotionDrivenProperty;
371
- /** The node and property it follows. */
372
- source: {
373
- node: string;
374
- property: MotionDrivenProperty;
375
- };
376
- /** Default 1 (0.5 moves at half the speed; 360 / (2π·radius) turns a wheel by how far it rolls). */
377
- factor?: number;
378
- /** Added to the change (default 0). */
379
- offset?: number;
380
- /** Limits the change to `[min, max]`. */
381
- clamp?: [number, number];
382
- }
383
- /** The placeholder target in a clip's commands. */
384
- declare const MOTION_CLIP_TARGET = "$";
385
- /** Plays a clip (`scene.clips`) on the targets: its commands, with `"$"` standing for each target. */
386
- interface MotionPlayCommand extends MotionCommandBase {
387
- type: 'play';
388
- /** The clip's name. */
389
- clip: string;
390
- /** Play it this many times as fast (default 1). */
391
- speed?: number;
392
- }
393
- /** Moves targets along a path node, centre on the path. */
394
- interface MotionFollowCommand extends MotionCommandBase {
395
- type: 'follow';
396
- /** Id of a path node in the artwork (it can be hidden). */
397
- path: string;
398
- /**
399
- * Turn with the path's direction (default false). Moves, shakes and wiggles made during the
400
- * follow then turn with it too: they are offsets from the target's place on the path.
401
- */
402
- rotate?: boolean;
403
- /** Fractions of the path's length to travel between (default 0 → 1). */
404
- from?: number;
405
- to?: number;
406
- }
407
- /** Scales up and back, `count` times (draws the eye). */
408
- interface MotionPulseCommand extends MotionCommandBase {
409
- /**
410
- * `add` makes the change a layer over the pose instead of a change to it: it stacks on
411
- * whatever else moves the target (a shake on a slide), and what it adds stays once it ends.
412
- * Default `replace` for move, rotate and scale (the later change takes over), `add` for
413
- * pulse, shake, teeter, wave and wiggle.
414
- */
415
- blend?: 'replace' | 'add';
416
- type: 'pulse';
417
- /** Extra scale at the peak (default 0.15). */
418
- amount?: number;
419
- count?: number;
420
- }
421
- /** Shakes side to side (or up and down), settling. */
422
- interface MotionShakeCommand extends MotionCommandBase {
423
- /**
424
- * `add` makes the change a layer over the pose instead of a change to it: it stacks on
425
- * whatever else moves the target (a shake on a slide), and what it adds stays once it ends.
426
- * Default `replace` for move, rotate and scale (the later change takes over), `add` for
427
- * pulse, shake, teeter, wave and wiggle.
428
- */
429
- blend?: 'replace' | 'add';
430
- type: 'shake';
431
- /** Distance in document units (default 8). */
432
- amount?: number;
433
- count?: number;
434
- /** Default `horizontal`. */
435
- axis?: 'horizontal' | 'vertical';
436
- }
437
- /** Rocks about the centre by `angle` either way, settling (Flair's `emphasis.teeter`). */
438
- interface MotionTeeterCommand extends MotionCommandBase {
439
- /**
440
- * `add` makes the change a layer over the pose instead of a change to it: it stacks on
441
- * whatever else moves the target (a shake on a slide), and what it adds stays once it ends.
442
- * Default `replace` for move, rotate and scale (the later change takes over), `add` for
443
- * pulse, shake, teeter, wave and wiggle.
444
- */
445
- blend?: 'replace' | 'add';
446
- type: 'teeter';
447
- /** Degrees either way (default 8). */
448
- angle?: number;
449
- /** Rocks (default 3). */
450
- count?: number;
451
- }
452
- /** Bobs up and down without settling, like something floating (Flair's `emphasis.wave`). */
453
- interface MotionWaveCommand extends MotionCommandBase {
454
- /**
455
- * `add` makes the change a layer over the pose instead of a change to it: it stacks on
456
- * whatever else moves the target (a shake on a slide), and what it adds stays once it ends.
457
- * Default `replace` for move, rotate and scale (the later change takes over), `add` for
458
- * pulse, shake, teeter, wave and wiggle.
459
- */
460
- blend?: 'replace' | 'add';
461
- type: 'wave';
462
- /** Height in document units (default 6). */
463
- amount?: number;
464
- /** Bobs (default 2). */
465
- count?: number;
466
- }
467
- /**
468
- * Wanders about its place as smooth seeded noise, easing out of and back to rest (Flair's
469
- * `emphasis.wiggle`). The same seed always wanders the same way.
470
- */
471
- interface MotionWiggleCommand extends MotionCommandBase {
472
- /**
473
- * `add` makes the change a layer over the pose instead of a change to it: it stacks on
474
- * whatever else moves the target (a shake on a slide), and what it adds stays once it ends.
475
- * Default `replace` for move, rotate and scale (the later change takes over), `add` for
476
- * pulse, shake, teeter, wave and wiggle.
477
- */
478
- blend?: 'replace' | 'add';
479
- type: 'wiggle';
480
- /** Up to about this far, in document units (default 6). */
481
- amount?: number;
482
- /** Wanders per second, in Hz (default 3). */
483
- frequency?: number;
484
- /** Layers of finer detail (default 2). */
485
- octaves?: number;
486
- /** Also turns about the centre by up to about this many degrees (default 0). */
487
- rotate?: number;
488
- /** A whole number; default: one picked from the target's id, so each target wanders its own way. */
489
- seed?: number;
490
- }
491
- /** Tints solid paint toward a colour and back, `count` times (Flair's `emphasis.color-pulse`). */
492
- interface MotionColorPulseCommand extends MotionCommandBase {
493
- type: 'color-pulse';
494
- /** The tint (default `#f59e0b`). Mixes in OKLab. */
495
- color?: string;
496
- /** Which paint (default `fill`). On a group it tints every path in it. */
497
- paint?: 'fill' | 'stroke';
498
- count?: number;
499
- }
500
- /** Tweens a numeric parameter of a live path effect on the target (twist angle, wiggle time, zig zag size…). */
501
- interface MotionEffectCommand extends MotionCommandBase {
502
- type: 'effect';
503
- /** Id of an effect in the target node's `effects`. */
504
- effect: string;
505
- /** A numeric parameter of that effect, e.g. `angle`. */
506
- param: string;
507
- to: number;
508
- }
509
- /** Does nothing for `duration` ms. */
510
- interface MotionWaitCommand {
511
- type: 'wait';
512
- duration: number;
513
- with?: 'after' | 'previous';
514
- note?: string;
515
- }
516
- type MotionCommand = MotionEnterCommand | MotionExitCommand | MotionDrawCommand | MotionMoveCommand | MotionRotateCommand | MotionScaleCommand | MotionFadeCommand | MotionStyleCommand | MotionMorphCommand | MotionMatchCommand | MotionPlayCommand | MotionFollowCommand | MotionPulseCommand | MotionShakeCommand | MotionTeeterCommand | MotionWaveCommand | MotionWiggleCommand | MotionColorPulseCommand | MotionEffectCommand | MotionWaitCommand;
517
- type MotionCommandType = MotionCommand['type'];
518
- declare const MOTION_COMMAND_TYPES: readonly MotionCommandType[];
519
- declare const MOTION_ENTER_STYLES: readonly MotionEnterStyle[];
520
- declare const MOTION_BLENDS: readonly ["replace", "add"];
521
- declare const MOTION_REPEAT_MODES: readonly ["loop", "mirror", "offset"];
522
- declare const MOTION_EXIT_STYLES: readonly MotionExitStyle[];
523
- declare const MOTION_IRIS_SHAPES: readonly MotionIrisShape[];
524
- declare const MOTION_SPLIT_ORIENTATIONS: readonly MotionSplitOrientation[];
525
- declare const MOTION_DIRECTIONS: readonly MotionDirection[];
526
- /**
527
- * A colour parameter of the effect made from the scene: it stands for every use of its
528
- * `default` colour in the artwork and the commands, so recolouring it recolours them all.
529
- */
530
- interface MotionControl {
531
- /** Identifier, e.g. `accent`. */
532
- name: string;
533
- type: 'color';
534
- /** A `#rrggbb` colour used in the scene. */
535
- default: string;
536
- label?: string;
537
- }
538
- interface MotionPreset {
539
- name: string;
540
- values: Record<string, string>;
541
- }
542
- /** Default lengths (ms) of commands that give none. */
543
- declare const MOTION_DEFAULT_DURATIONS: Readonly<Record<Exclude<MotionCommandType, 'wait' | 'draw'>, number>>;
544
- /** Default hold after a shot's commands (ms). */
545
- declare const MOTION_DEFAULT_HOLD = 600;
546
- /** Default camera move (ms). */
547
- declare const MOTION_CAMERA_MS = 1000;
548
- /** `draw` lasts `length × MOTION_DRAW_MS_PER_UNIT`, clamped to `MOTION_DRAW_RANGE`. */
549
- declare const MOTION_DRAW_MS_PER_UNIT = 1.5;
550
- declare const MOTION_DRAW_RANGE: readonly [number, number];
551
- /**
552
- * The Flair motion primitive (`@pixerate/flair/motion`) a command plays, or undefined when
553
- * Flair has none (`move`, `scale`, `fade`, `style`, `morph`, `effect`, `wait` are the editor's
554
- * own). Commands and primitives of the same name take the same parameters and defaults.
555
- */
556
- declare function motionFlairPrimitive(command: MotionCommand): string | undefined;
557
-
558
- /**
559
- * Export to Flair (`@pixerate/flair`): a scene becomes an `SvgMotion` (one SVG plus a list of
560
- * from → to changes on its elements), a catalog `VectorEffect`, or an `EffectDocument` for
561
- * Flair's effect editor. The types are mirrored here so this package does not depend on Flair.
562
- *
563
- * Changes are exact where Flair can express them: a change with a linear, cubic-out or
564
- * cubic-in-out curve (the editor's defaults) is one change, and so (Flair 0.36 and later) is
565
- * one with any cubic-bezier curve, written as `[x1, y1, x2, y2]`. Anything else (springs,
566
- * elastic, `hold`, morphs and live-effect tweens) is sampled at the
567
- * scene's `fps` into short linear changes, which Flair plays the same way. Pulses, shakes,
568
- * teeters, waves, wiggles and colour pulses are one change with a `behavior` (Flair 0.38).
569
- *
570
- * Reveals (`wipe`, `iris`, `split`) wrap their node in a group clipped through a rect or circle
571
- * in the group's own box units (`clipPathUnits="objectBoundingBox"`), as Flair's
572
- * `entrance.wipe` does, and animate the shape's attributes. A follow wraps its node in a group
573
- * that Flair's `along` carries along a copy of the path in the node's parent's units (written
574
- * in `<defs>`, so the path may be hidden or anywhere), turning with it for `orient`, as
575
- * Flair's `path.follow` does.
576
- */
577
- /** Flair's easing names. */
578
- type FlairEaseName = 'linear' | 'in-out' | 'out';
579
- /** Flair's spring ease (Flair 0.39 and later): the editor's spring, number for number. */
580
- interface FlairSpringEase {
581
- spring: {
582
- mass?: number;
583
- stiffness?: number;
584
- damping?: number;
585
- velocity?: number;
586
- };
587
- }
588
- /** A Flair easing: a name, (Flair 0.36 and later) a CSS cubic-bezier `[x1, y1, x2, y2]`, or (0.39) a spring. */
589
- type FlairEase = FlairEaseName | readonly [number, number, number, number] | FlairSpringEase;
590
- /** Flair's curves, for matching. */
591
- declare const FLAIR_EASES: Readonly<Record<FlairEaseName, (t: number) => number>>;
592
- /** One change of a Flair `SvgMotion` (mirrors `SvgAnimation` in `@pixerate/flair/vector`). */
593
- interface FlairSvgAnimation {
594
- id?: string;
595
- step?: number;
596
- delay?: number;
597
- ms?: number;
598
- ease?: FlairEase;
599
- attrs?: Record<string, readonly [string | number, string | number]>;
600
- draw?: boolean | readonly [number, number];
601
- /** Moves the element along a path (by id), from and to the fractions of its length in `at`. */
602
- along?: string;
603
- at?: readonly [number, number];
604
- /** With `along`: turns the element with the path's direction. */
605
- orient?: boolean;
606
- /** Flair 0.38 and later: how the change swings from → to (see `MotionBehavior`). */
607
- behavior?: MotionBehavior;
608
- /** Flair 0.39 and later: stepped time, held on a grid of this many frames per second. */
609
- strobe?: number;
610
- /** Flair 0.39 and later: whole cycles to play (default 1); with `alternate`, every other one backwards. */
611
- repeat?: number;
612
- alternate?: boolean;
613
- /** Flair features scenes do not have (imports skip them with a note). */
614
- count?: readonly [number, number];
615
- /** With `count`: how the number is written (Flair's number format) and to how many decimals. */
616
- format?: string;
617
- decimals?: number;
618
- write?: string;
619
- /** With `write`: the caret drawn while typing. */
620
- caret?: string;
621
- /** Flair's label for the change, e.g. `entrance.fade@logo`; motion primitives set it to find their changes again. */
622
- tag?: string;
623
- scramble?: string;
624
- solo?: number;
625
- view?: readonly [number, number, number, number] | string;
626
- }
627
- /** Mirrors `SvgMotion` in `@pixerate/flair/vector`. */
628
- interface FlairSvgMotion {
629
- svg: string;
630
- animate?: FlairSvgAnimation[];
631
- }
632
- /** Mirrors Flair's catalog `VectorEffect` (`@pixerate/flair/catalog`). */
633
- interface FlairVectorEffect {
634
- kind: 'vector';
635
- id: string;
636
- name: string;
637
- description: string;
638
- category: string;
639
- tags: string[];
640
- motion: FlairSvgMotion;
641
- /** Values are `#rrggbb` strings, or `[r, g, b]` channels from 0 to 1 (Flair's catalog writes both); imports turn them into hex. */
642
- presets?: {
643
- name: string;
644
- values: Record<string, string | readonly number[]>;
645
- }[];
646
- /** Ms on the last frame before looping. */
647
- hold?: number;
648
- trigger?: 'hover' | 'press' | 'click' | 'scroll';
649
- }
650
- /** Mirrors Flair's `EffectDocument` (`@pixerate/flair/editor`) for a vector effect. */
651
- interface FlairEffectDocument {
652
- version: 1;
653
- name: string;
654
- effect: {
655
- kind: 'vector';
656
- motion: FlairSvgMotion;
657
- hold?: number;
658
- };
659
- values: Record<string, string>;
660
- tracks: Record<string, never>;
661
- duration: number;
662
- loop: boolean;
663
- presets: {
664
- name: string;
665
- values: Record<string, string>;
666
- }[];
667
- }
668
- interface FlairMotionExport {
669
- motion: FlairSvgMotion;
670
- /** The scene's length (ms). */
671
- duration: number;
672
- /** Ms after the last change (Flair's `hold`). */
673
- hold: number;
674
- /** Changes sampled into linear steps. */
675
- sampled: number;
676
- /** What could not be carried over, in sentences. */
677
- notes: string[];
678
- /** How the viewer plays it: pass to Flair's `SvgPlayer` as `{ trigger }` (from the scene's `trigger`). */
679
- trigger?: MotionTrigger;
680
- }
681
- interface FlairExportOptions {
682
- /**
683
- * Play in answer to the viewer (default: the scene's `trigger`; null for none). With `click`
684
- * shot n is Flair step n + 1: nothing plays until the first click, and each click plays the next shot.
685
- */
686
- trigger?: MotionTrigger | null;
687
- /** Sampling rate for changes Flair cannot express exactly (default: the scene's `fps`, else 30). */
688
- fps?: number;
689
- /** Decimal places (default 3). */
690
- precision?: number;
691
- /**
692
- * Write cubic-bezier easings (the `ease`, `ease-in`, `ease-out`, `ease-in-out`, `ease-in-back`
693
- * and `ease-out-back` presets, and `{ type: 'cubic-bezier' }` curves) as one change with
694
- * `ease: [x1, y1, x2, y2]` (default true). Needs Flair 0.36 or later; set false for older
695
- * Flair, and they are sampled into linear steps.
696
- */
697
- curves?: boolean;
698
- /**
699
- * Write pulses, shakes, teeters, waves, wiggles and colour pulses as one change with a Flair
700
- * `behavior` (default true), so they play exactly. Needs Flair 0.38 or later; set false for
701
- * older Flair, and they are sampled into linear steps.
702
- */
703
- behaviors?: boolean;
704
- /**
705
- * The Flair version the export is for (default `0.39`): it decides what is written exactly
706
- * and what is sampled. 0.36 adds cubic-bezier curves, 0.38 behaviours, 0.39 springs and
707
- * stepped time (`strobe`). `curves` and `behaviors` override it.
708
- */
709
- flair?: string;
710
- }
711
- /** The Flair version exports target by default. */
712
- declare const FLAIR_EXPORT_VERSION = "0.39";
713
- /** Whether Flair `version` is at least `min` (dotted numbers). */
714
- declare function flairAtLeast(version: string, min: string): boolean;
715
- /** The Flair easing that matches `ease` (within 1% everywhere), if any. */
716
- declare function flairEaseFor(ease: AnimationEasing): FlairEaseName | undefined;
717
- /**
718
- * The Flair easing for `ease`: a Flair name when one matches within 1%, else (with `curves`,
719
- * the default) the curve's `[x1, y1, x2, y2]` when it is a cubic-bezier. Undefined for curves
720
- * Flair cannot play (springs, elastic, `hold`), which are sampled.
721
- */
722
- declare function flairCurveFor(ease: AnimationEasing, curves?: boolean): FlairEase | undefined;
723
- /** A scene as a Flair `SvgMotion`. */
724
- declare function toFlairSvgMotion(scene: MotionScene, options?: FlairExportOptions): FlairMotionExport;
725
- interface FlairEffectOptions extends FlairExportOptions {
726
- /** Kebab-case id (default: the scene's name). */
727
- id?: string;
728
- name?: string;
729
- description?: string;
730
- /** Flair catalog category (default `icon`). */
731
- category?: string;
732
- tags?: string[];
733
- }
734
- /** A scene as a Flair catalog vector effect, with its colour controls and presets. */
735
- declare function toFlairVectorEffect(scene: MotionScene, options?: FlairEffectOptions): FlairVectorEffect;
736
- /** A scene as a document for Flair's `EffectEditor` (`replaceDocument`). */
737
- declare function toFlairEffectDocument(scene: MotionScene, options?: FlairExportOptions): FlairEffectDocument;
738
-
739
- export { type MotionCommandBase as $, type MotionNarration as A, FLAIR_EASES as B, FLAIR_EXPORT_VERSION as C, type FlairEase as D, type FlairEaseName as E, type FlairSvgAnimation as F, type FlairSpringEase as G, MOTION_BLENDS as H, MOTION_CAMERA_MS as I, MOTION_CASCADES as J, MOTION_CLIP_TARGET as K, MOTION_COMMAND_TYPES as L, type MotionCommand as M, MOTION_DEFAULT_DURATIONS as N, MOTION_DEFAULT_HOLD as O, MOTION_DIRECTIONS as P, MOTION_DRAW_MS_PER_UNIT as Q, MOTION_DRAW_RANGE as R, MOTION_DRIVEN_PROPERTIES as S, MOTION_ENTER_STYLES as T, MOTION_EXIT_STYLES as U, MOTION_IRIS_SHAPES as V, MOTION_REPEAT_MODES as W, MOTION_SPLIT_ORIENTATIONS as X, MOTION_TEXT_UNITS as Y, MOTION_TRIGGERS as Z, type MotionColorPulseCommand as _, type MotionShot as a, type MotionDrawCommand as a0, type MotionDrawOrder as a1, type MotionEffectCommand as a2, type MotionEnterCommand as a3, type MotionExitCommand as a4, type MotionFadeCommand as a5, type MotionFollowCommand as a6, type MotionMatchCommand as a7, type MotionMorphCommand as a8, type MotionMoveCommand as a9, type MotionPlayCommand as aa, type MotionPulseCommand as ab, type MotionRotateCommand as ac, type MotionScaleCommand as ad, type MotionShakeCommand as ae, type MotionStyleCommand as af, type MotionTeeterCommand as ag, type MotionTrigger as ah, type MotionWaitCommand as ai, type MotionWaveCommand as aj, type MotionWiggleCommand as ak, flairAtLeast as al, flairCurveFor as am, flairEaseFor as an, motionFlairPrimitive as ao, toFlairEffectDocument as ap, toFlairSvgMotion as aq, toFlairVectorEffect as ar, type MotionScene as b, type MotionDirection as c, type MotionIrisShape as d, type MotionSplitOrientation as e, type MotionDriver as f, type MotionDrivenProperty as g, type MotionRect as h, type MotionBeatGrid as i, type MotionCue as j, type MotionCamera as k, type MotionTextUnit as l, type MotionCascade as m, type MotionBlur as n, type MotionControl as o, type MotionPreset as p, type MotionClip as q, type FlairSvgMotion as r, type FlairVectorEffect as s, type FlairExportOptions as t, type FlairMotionExport as u, type FlairEffectOptions as v, type FlairEffectDocument as w, type MotionEnterStyle as x, type MotionExitStyle as y, type MotionCommandType as z };