@pixerate/editor 0.55.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +18 -17
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.js +3 -2
- package/dist/agent/index.js.map +1 -1
- package/dist/animation-editor/index.cjs +25 -7
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +21 -5
- package/dist/animation-editor/index.d.ts +21 -5
- package/dist/animation-editor/index.js +25 -7
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/canvas/index.cjs +2105 -172
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +319 -23
- package/dist/canvas/index.d.ts +319 -23
- package/dist/canvas/index.js +2081 -148
- package/dist/canvas/index.js.map +1 -1
- package/dist/chart/index.cjs +32 -30
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +4 -2
- package/dist/chart/index.d.ts +4 -2
- package/dist/chart/index.js +20 -18
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-C3JHII3M.cjs → chunk-3I6V7PI4.cjs} +45 -45
- package/dist/{chunk-C3JHII3M.cjs.map → chunk-3I6V7PI4.cjs.map} +1 -1
- package/dist/{chunk-P43HUQRX.cjs → chunk-AHCENCU4.cjs} +12 -10
- package/dist/chunk-AHCENCU4.cjs.map +1 -0
- package/dist/chunk-II77MLHN.cjs +11106 -0
- package/dist/chunk-II77MLHN.cjs.map +1 -0
- package/dist/{chunk-OIKYP7XC.js → chunk-LMUDHBWR.js} +2 -2
- package/dist/{chunk-VODBAO32.js → chunk-OEFCLWZ3.js} +4 -1425
- package/dist/chunk-OEFCLWZ3.js.map +1 -0
- package/dist/{chunk-NK3WL5TJ.cjs → chunk-P2CTDJNF.cjs} +27 -1448
- package/dist/chunk-P2CTDJNF.cjs.map +1 -0
- package/dist/chunk-TKPPIVW7.cjs +1443 -0
- package/dist/chunk-TKPPIVW7.cjs.map +1 -0
- package/dist/chunk-WJSCGBJ2.js +11106 -0
- package/dist/chunk-WJSCGBJ2.js.map +1 -0
- package/dist/{chunk-RIXTW3C4.js → chunk-WLVZ235X.js} +5 -3
- package/dist/{chunk-RIXTW3C4.js.map → chunk-WLVZ235X.js.map} +1 -1
- package/dist/chunk-ZOH6X3VR.js +1443 -0
- package/dist/chunk-ZOH6X3VR.js.map +1 -0
- package/dist/{controller-DscWQbjO.d.ts → controller-D2rj5umx.d.ts} +2 -362
- package/dist/{controller-CX0QfSv0.d.cts → controller-R2biKk_E.d.cts} +2 -362
- package/dist/diagram/index.cjs +1457 -47
- package/dist/diagram/index.cjs.map +1 -1
- package/dist/diagram/index.d.cts +1734 -15
- package/dist/diagram/index.d.ts +1734 -15
- package/dist/diagram/index.js +1436 -26
- package/dist/diagram/index.js.map +1 -1
- package/dist/extensions/index.cjs +5 -4
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +4 -3
- package/dist/extensions/index.d.ts +4 -3
- package/dist/extensions/index.js +4 -3
- package/dist/{index-DIWB6xMf.d.cts → index-BcHyG0Wq.d.cts} +2 -1
- package/dist/{index-CALDD35B.d.ts → index-CTCc3m3C.d.ts} +2 -1
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/types-BRp-6zkY.d.cts +362 -0
- package/dist/types-BRp-6zkY.d.ts +362 -0
- package/dist/{types-BULrFyuQ.d.cts → types-DYkjhzdz.d.cts} +1 -1
- package/dist/{types-BULrFyuQ.d.ts → types-DYkjhzdz.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-H5K77C7Y.cjs +0 -3848
- package/dist/chunk-H5K77C7Y.cjs.map +0 -1
- package/dist/chunk-NK3WL5TJ.cjs.map +0 -1
- package/dist/chunk-P43HUQRX.cjs.map +0 -1
- package/dist/chunk-VODBAO32.js.map +0 -1
- package/dist/chunk-WWJNC7SX.js +0 -3848
- package/dist/chunk-WWJNC7SX.js.map +0 -1
- /package/dist/{chunk-OIKYP7XC.js.map → chunk-LMUDHBWR.js.map} +0 -0
|
@@ -629,12 +629,15 @@ declare function createMotionScene(artwork: VectorDocument, init?: Partial<Omit<
|
|
|
629
629
|
* Flair's effect editor. The types are mirrored here so this package does not depend on Flair.
|
|
630
630
|
*
|
|
631
631
|
* Changes are exact where Flair can express them: a change with a linear, cubic-out or
|
|
632
|
-
* cubic-in-out curve (the editor's defaults) is one change
|
|
633
|
-
*
|
|
634
|
-
*
|
|
632
|
+
* cubic-in-out curve (the editor's defaults) is one change, and so (Flair 0.36 and later) is
|
|
633
|
+
* one with any cubic-bezier curve, written as `[x1, y1, x2, y2]`. Anything else (springs,
|
|
634
|
+
* elastic, `hold`, pulses and shakes, follows, morphs and live-effect tweens) is sampled at the
|
|
635
|
+
* scene's `fps` into short linear changes, which Flair plays the same way.
|
|
635
636
|
*/
|
|
636
637
|
/** Flair's easing names. */
|
|
637
638
|
type FlairEaseName = 'linear' | 'in-out' | 'out';
|
|
639
|
+
/** A Flair easing: a name, or (Flair 0.36 and later) a CSS cubic-bezier `[x1, y1, x2, y2]`. */
|
|
640
|
+
type FlairEase = FlairEaseName | readonly [number, number, number, number];
|
|
638
641
|
/** Flair's curves, for matching. */
|
|
639
642
|
declare const FLAIR_EASES: Readonly<Record<FlairEaseName, (t: number) => number>>;
|
|
640
643
|
/** One change of a Flair `SvgMotion` (mirrors `SvgAnimation` in `@pixerate/flair/vector`). */
|
|
@@ -643,7 +646,7 @@ interface FlairSvgAnimation {
|
|
|
643
646
|
step?: number;
|
|
644
647
|
delay?: number;
|
|
645
648
|
ms?: number;
|
|
646
|
-
ease?:
|
|
649
|
+
ease?: FlairEase;
|
|
647
650
|
attrs?: Record<string, readonly [string | number, string | number]>;
|
|
648
651
|
draw?: boolean | readonly [number, number];
|
|
649
652
|
view?: readonly [number, number, number, number] | string;
|
|
@@ -704,9 +707,22 @@ interface FlairExportOptions {
|
|
|
704
707
|
fps?: number;
|
|
705
708
|
/** Decimal places (default 3). */
|
|
706
709
|
precision?: number;
|
|
710
|
+
/**
|
|
711
|
+
* Write cubic-bezier easings (the `ease`, `ease-in`, `ease-out`, `ease-in-out`, `ease-in-back`
|
|
712
|
+
* and `ease-out-back` presets, and `{ type: 'cubic-bezier' }` curves) as one change with
|
|
713
|
+
* `ease: [x1, y1, x2, y2]` (default true). Needs Flair 0.36 or later; set false for older
|
|
714
|
+
* Flair, and they are sampled into linear steps.
|
|
715
|
+
*/
|
|
716
|
+
curves?: boolean;
|
|
707
717
|
}
|
|
708
718
|
/** The Flair easing that matches `ease` (within 1% everywhere), if any. */
|
|
709
719
|
declare function flairEaseFor(ease: AnimationEasing): FlairEaseName | undefined;
|
|
720
|
+
/**
|
|
721
|
+
* The Flair easing for `ease`: a Flair name when one matches within 1%, else (with `curves`,
|
|
722
|
+
* the default) the curve's `[x1, y1, x2, y2]` when it is a cubic-bezier. Undefined for curves
|
|
723
|
+
* Flair cannot play (springs, elastic, `hold`), which are sampled.
|
|
724
|
+
*/
|
|
725
|
+
declare function flairCurveFor(ease: AnimationEasing, curves?: boolean): FlairEase | undefined;
|
|
710
726
|
/** A scene as a Flair `SvgMotion`. */
|
|
711
727
|
declare function toFlairSvgMotion(scene: MotionScene, options?: FlairExportOptions): FlairMotionExport;
|
|
712
728
|
interface FlairEffectOptions extends FlairExportOptions {
|
|
@@ -1114,4 +1130,4 @@ declare function createAnimationEditorToolProvider(controller: AnimationEditorCo
|
|
|
1114
1130
|
*/
|
|
1115
1131
|
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- 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- morph turns a shape into another node's shape (keep the target hidden); follow moves along a path node; pulse and shake draw the eye.\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).\n2. Plan a few shots, each one idea. Add them with insert_shots, or edit_animation to make several edits as one step (dry_run first when unsure).\n3. check_animation and fix every error and warning; render_animation_frame (shot + \"end\") to look at the result.\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.";
|
|
1116
1132
|
|
|
1117
|
-
export { ANIMATION_EDITOR_AGENT_INSTRUCTIONS, AnimationEditorController, type AnimationEditorOptions, type AnimationEditorSelection, type AnimationEditorState, type AnimationEditorToolProviderOptions, FLAIR_EASES, type FlairEaseName, type FlairEffectDocument, type FlairEffectOptions, type FlairExportOptions, type FlairMotionExport, type FlairSvgAnimation, type FlairSvgMotion, type FlairVectorEffect, 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_IN_OUT, MOTION_EASE_OUT, MOTION_EDIT_OPS, MOTION_ENTER_STYLES, MOTION_EXIT_STYLES, MOTION_ISSUE_CODES, MOTION_MIN_CHANGE_MS, type MotionCamera, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionControl, type MotionDirection, type MotionDrawCommand, type MotionEdit, type MotionEditOp, type MotionEditResult, type MotionEffectCommand, type MotionEnterCommand, type MotionEnterStyle, type MotionExitCommand, type MotionExitStyle, type MotionFadeCommand, type MotionFollowCommand, type MotionFrame, type MotionFrameOptions, type MotionIssue, type MotionIssueCode, type MotionIssueSeverity, type MotionMorphCommand, type MotionMoveCommand, type MotionNodeEntry, type MotionPreset, type MotionProperty, type MotionPulseCommand, type MotionRect, type MotionRotateCommand, type MotionScaleCommand, type MotionScene, MotionSceneFormatError, type MotionSegment, type MotionShakeCommand, type MotionShot, type MotionShotTiming, type MotionStyleCommand, type MotionSvgOptions, type MotionTimeline, type MotionValue, type MotionWaitCommand, type MotionWave, activeSegment, applyMotionControlValues, applyMotionEdits, checkMotionScene, commandShapeProblems, compileMotionScene, createAnimationEditorToolProvider, createMotionScene, describeMotionElements, describeMotionShots, fitMotionRect, flairEaseFor, freshShotId, indexMotionNodes, interpolateMotionValue, isMotionCommand, isMotionShot, motionCommandDuration, motionFrameAt, motionFrameToSvg, motionIssue, motionIssueKey, motionIssueLine, motionNodeOffset, motionPathLength, motionRestValue, motionSceneShapeProblems, motionSceneToJson, motionShotAt, motionTrackKey, namedWithSuggestion, parseMotionScene, resolveMotionCamera, segmentProgress, segmentValue, shotShapeProblems, suggestName, toFlairEffectDocument, toFlairSvgMotion, toFlairVectorEffect, trackValue, withViewBox };
|
|
1133
|
+
export { ANIMATION_EDITOR_AGENT_INSTRUCTIONS, AnimationEditorController, type AnimationEditorOptions, type AnimationEditorSelection, type AnimationEditorState, type AnimationEditorToolProviderOptions, FLAIR_EASES, type FlairEase, type FlairEaseName, type FlairEffectDocument, type FlairEffectOptions, type FlairExportOptions, type FlairMotionExport, type FlairSvgAnimation, type FlairSvgMotion, type FlairVectorEffect, 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_IN_OUT, MOTION_EASE_OUT, MOTION_EDIT_OPS, MOTION_ENTER_STYLES, MOTION_EXIT_STYLES, MOTION_ISSUE_CODES, MOTION_MIN_CHANGE_MS, type MotionCamera, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionControl, type MotionDirection, type MotionDrawCommand, type MotionEdit, type MotionEditOp, type MotionEditResult, type MotionEffectCommand, type MotionEnterCommand, type MotionEnterStyle, type MotionExitCommand, type MotionExitStyle, type MotionFadeCommand, type MotionFollowCommand, type MotionFrame, type MotionFrameOptions, type MotionIssue, type MotionIssueCode, type MotionIssueSeverity, type MotionMorphCommand, type MotionMoveCommand, type MotionNodeEntry, type MotionPreset, type MotionProperty, type MotionPulseCommand, type MotionRect, type MotionRotateCommand, type MotionScaleCommand, type MotionScene, MotionSceneFormatError, type MotionSegment, type MotionShakeCommand, type MotionShot, type MotionShotTiming, type MotionStyleCommand, type MotionSvgOptions, type MotionTimeline, type MotionValue, type MotionWaitCommand, type MotionWave, activeSegment, applyMotionControlValues, applyMotionEdits, checkMotionScene, commandShapeProblems, compileMotionScene, createAnimationEditorToolProvider, createMotionScene, describeMotionElements, describeMotionShots, fitMotionRect, flairCurveFor, flairEaseFor, freshShotId, indexMotionNodes, interpolateMotionValue, isMotionCommand, isMotionShot, motionCommandDuration, motionFrameAt, motionFrameToSvg, motionIssue, motionIssueKey, motionIssueLine, motionNodeOffset, motionPathLength, motionRestValue, motionSceneShapeProblems, motionSceneToJson, motionShotAt, motionTrackKey, namedWithSuggestion, parseMotionScene, resolveMotionCamera, segmentProgress, segmentValue, shotShapeProblems, suggestName, toFlairEffectDocument, toFlairSvgMotion, toFlairVectorEffect, trackValue, withViewBox };
|
|
@@ -629,12 +629,15 @@ declare function createMotionScene(artwork: VectorDocument, init?: Partial<Omit<
|
|
|
629
629
|
* Flair's effect editor. The types are mirrored here so this package does not depend on Flair.
|
|
630
630
|
*
|
|
631
631
|
* Changes are exact where Flair can express them: a change with a linear, cubic-out or
|
|
632
|
-
* cubic-in-out curve (the editor's defaults) is one change
|
|
633
|
-
*
|
|
634
|
-
*
|
|
632
|
+
* cubic-in-out curve (the editor's defaults) is one change, and so (Flair 0.36 and later) is
|
|
633
|
+
* one with any cubic-bezier curve, written as `[x1, y1, x2, y2]`. Anything else (springs,
|
|
634
|
+
* elastic, `hold`, pulses and shakes, follows, morphs and live-effect tweens) is sampled at the
|
|
635
|
+
* scene's `fps` into short linear changes, which Flair plays the same way.
|
|
635
636
|
*/
|
|
636
637
|
/** Flair's easing names. */
|
|
637
638
|
type FlairEaseName = 'linear' | 'in-out' | 'out';
|
|
639
|
+
/** A Flair easing: a name, or (Flair 0.36 and later) a CSS cubic-bezier `[x1, y1, x2, y2]`. */
|
|
640
|
+
type FlairEase = FlairEaseName | readonly [number, number, number, number];
|
|
638
641
|
/** Flair's curves, for matching. */
|
|
639
642
|
declare const FLAIR_EASES: Readonly<Record<FlairEaseName, (t: number) => number>>;
|
|
640
643
|
/** One change of a Flair `SvgMotion` (mirrors `SvgAnimation` in `@pixerate/flair/vector`). */
|
|
@@ -643,7 +646,7 @@ interface FlairSvgAnimation {
|
|
|
643
646
|
step?: number;
|
|
644
647
|
delay?: number;
|
|
645
648
|
ms?: number;
|
|
646
|
-
ease?:
|
|
649
|
+
ease?: FlairEase;
|
|
647
650
|
attrs?: Record<string, readonly [string | number, string | number]>;
|
|
648
651
|
draw?: boolean | readonly [number, number];
|
|
649
652
|
view?: readonly [number, number, number, number] | string;
|
|
@@ -704,9 +707,22 @@ interface FlairExportOptions {
|
|
|
704
707
|
fps?: number;
|
|
705
708
|
/** Decimal places (default 3). */
|
|
706
709
|
precision?: number;
|
|
710
|
+
/**
|
|
711
|
+
* Write cubic-bezier easings (the `ease`, `ease-in`, `ease-out`, `ease-in-out`, `ease-in-back`
|
|
712
|
+
* and `ease-out-back` presets, and `{ type: 'cubic-bezier' }` curves) as one change with
|
|
713
|
+
* `ease: [x1, y1, x2, y2]` (default true). Needs Flair 0.36 or later; set false for older
|
|
714
|
+
* Flair, and they are sampled into linear steps.
|
|
715
|
+
*/
|
|
716
|
+
curves?: boolean;
|
|
707
717
|
}
|
|
708
718
|
/** The Flair easing that matches `ease` (within 1% everywhere), if any. */
|
|
709
719
|
declare function flairEaseFor(ease: AnimationEasing): FlairEaseName | undefined;
|
|
720
|
+
/**
|
|
721
|
+
* The Flair easing for `ease`: a Flair name when one matches within 1%, else (with `curves`,
|
|
722
|
+
* the default) the curve's `[x1, y1, x2, y2]` when it is a cubic-bezier. Undefined for curves
|
|
723
|
+
* Flair cannot play (springs, elastic, `hold`), which are sampled.
|
|
724
|
+
*/
|
|
725
|
+
declare function flairCurveFor(ease: AnimationEasing, curves?: boolean): FlairEase | undefined;
|
|
710
726
|
/** A scene as a Flair `SvgMotion`. */
|
|
711
727
|
declare function toFlairSvgMotion(scene: MotionScene, options?: FlairExportOptions): FlairMotionExport;
|
|
712
728
|
interface FlairEffectOptions extends FlairExportOptions {
|
|
@@ -1114,4 +1130,4 @@ declare function createAnimationEditorToolProvider(controller: AnimationEditorCo
|
|
|
1114
1130
|
*/
|
|
1115
1131
|
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- 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- morph turns a shape into another node's shape (keep the target hidden); follow moves along a path node; pulse and shake draw the eye.\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).\n2. Plan a few shots, each one idea. Add them with insert_shots, or edit_animation to make several edits as one step (dry_run first when unsure).\n3. check_animation and fix every error and warning; render_animation_frame (shot + \"end\") to look at the result.\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.";
|
|
1116
1132
|
|
|
1117
|
-
export { ANIMATION_EDITOR_AGENT_INSTRUCTIONS, AnimationEditorController, type AnimationEditorOptions, type AnimationEditorSelection, type AnimationEditorState, type AnimationEditorToolProviderOptions, FLAIR_EASES, type FlairEaseName, type FlairEffectDocument, type FlairEffectOptions, type FlairExportOptions, type FlairMotionExport, type FlairSvgAnimation, type FlairSvgMotion, type FlairVectorEffect, 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_IN_OUT, MOTION_EASE_OUT, MOTION_EDIT_OPS, MOTION_ENTER_STYLES, MOTION_EXIT_STYLES, MOTION_ISSUE_CODES, MOTION_MIN_CHANGE_MS, type MotionCamera, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionControl, type MotionDirection, type MotionDrawCommand, type MotionEdit, type MotionEditOp, type MotionEditResult, type MotionEffectCommand, type MotionEnterCommand, type MotionEnterStyle, type MotionExitCommand, type MotionExitStyle, type MotionFadeCommand, type MotionFollowCommand, type MotionFrame, type MotionFrameOptions, type MotionIssue, type MotionIssueCode, type MotionIssueSeverity, type MotionMorphCommand, type MotionMoveCommand, type MotionNodeEntry, type MotionPreset, type MotionProperty, type MotionPulseCommand, type MotionRect, type MotionRotateCommand, type MotionScaleCommand, type MotionScene, MotionSceneFormatError, type MotionSegment, type MotionShakeCommand, type MotionShot, type MotionShotTiming, type MotionStyleCommand, type MotionSvgOptions, type MotionTimeline, type MotionValue, type MotionWaitCommand, type MotionWave, activeSegment, applyMotionControlValues, applyMotionEdits, checkMotionScene, commandShapeProblems, compileMotionScene, createAnimationEditorToolProvider, createMotionScene, describeMotionElements, describeMotionShots, fitMotionRect, flairEaseFor, freshShotId, indexMotionNodes, interpolateMotionValue, isMotionCommand, isMotionShot, motionCommandDuration, motionFrameAt, motionFrameToSvg, motionIssue, motionIssueKey, motionIssueLine, motionNodeOffset, motionPathLength, motionRestValue, motionSceneShapeProblems, motionSceneToJson, motionShotAt, motionTrackKey, namedWithSuggestion, parseMotionScene, resolveMotionCamera, segmentProgress, segmentValue, shotShapeProblems, suggestName, toFlairEffectDocument, toFlairSvgMotion, toFlairVectorEffect, trackValue, withViewBox };
|
|
1133
|
+
export { ANIMATION_EDITOR_AGENT_INSTRUCTIONS, AnimationEditorController, type AnimationEditorOptions, type AnimationEditorSelection, type AnimationEditorState, type AnimationEditorToolProviderOptions, FLAIR_EASES, type FlairEase, type FlairEaseName, type FlairEffectDocument, type FlairEffectOptions, type FlairExportOptions, type FlairMotionExport, type FlairSvgAnimation, type FlairSvgMotion, type FlairVectorEffect, 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_IN_OUT, MOTION_EASE_OUT, MOTION_EDIT_OPS, MOTION_ENTER_STYLES, MOTION_EXIT_STYLES, MOTION_ISSUE_CODES, MOTION_MIN_CHANGE_MS, type MotionCamera, type MotionCommand, type MotionCommandBase, type MotionCommandTiming, type MotionCommandType, type MotionControl, type MotionDirection, type MotionDrawCommand, type MotionEdit, type MotionEditOp, type MotionEditResult, type MotionEffectCommand, type MotionEnterCommand, type MotionEnterStyle, type MotionExitCommand, type MotionExitStyle, type MotionFadeCommand, type MotionFollowCommand, type MotionFrame, type MotionFrameOptions, type MotionIssue, type MotionIssueCode, type MotionIssueSeverity, type MotionMorphCommand, type MotionMoveCommand, type MotionNodeEntry, type MotionPreset, type MotionProperty, type MotionPulseCommand, type MotionRect, type MotionRotateCommand, type MotionScaleCommand, type MotionScene, MotionSceneFormatError, type MotionSegment, type MotionShakeCommand, type MotionShot, type MotionShotTiming, type MotionStyleCommand, type MotionSvgOptions, type MotionTimeline, type MotionValue, type MotionWaitCommand, type MotionWave, activeSegment, applyMotionControlValues, applyMotionEdits, checkMotionScene, commandShapeProblems, compileMotionScene, createAnimationEditorToolProvider, createMotionScene, describeMotionElements, describeMotionShots, fitMotionRect, flairCurveFor, flairEaseFor, freshShotId, indexMotionNodes, interpolateMotionValue, isMotionCommand, isMotionShot, motionCommandDuration, motionFrameAt, motionFrameToSvg, motionIssue, motionIssueKey, motionIssueLine, motionNodeOffset, motionPathLength, motionRestValue, motionSceneShapeProblems, motionSceneToJson, motionShotAt, motionTrackKey, namedWithSuggestion, parseMotionScene, resolveMotionCamera, segmentProgress, segmentValue, shotShapeProblems, suggestName, toFlairEffectDocument, toFlairSvgMotion, toFlairVectorEffect, trackValue, withViewBox };
|
|
@@ -41,7 +41,8 @@ import {
|
|
|
41
41
|
import {
|
|
42
42
|
ANIMATION_EASING_PRESETS,
|
|
43
43
|
evaluateEasing,
|
|
44
|
-
isAnimationEasing
|
|
44
|
+
isAnimationEasing,
|
|
45
|
+
resolveEasing
|
|
45
46
|
} from "../chunk-UB2OY7FD.js";
|
|
46
47
|
|
|
47
48
|
// src/animation-editor/types.ts
|
|
@@ -1231,6 +1232,14 @@ function flairEaseFor(ease) {
|
|
|
1231
1232
|
}
|
|
1232
1233
|
return void 0;
|
|
1233
1234
|
}
|
|
1235
|
+
function flairCurveFor(ease, curves = true) {
|
|
1236
|
+
const name = flairEaseFor(ease);
|
|
1237
|
+
if (name || !curves) return name;
|
|
1238
|
+
const resolved = resolveEasing(ease);
|
|
1239
|
+
if (resolved === "hold" || resolved.type !== "cubic-bezier") return void 0;
|
|
1240
|
+
return [resolved.x1, resolved.y1, resolved.x2, resolved.y2];
|
|
1241
|
+
}
|
|
1242
|
+
var overshoots = (ease) => typeof ease !== "string" && (ease[1] < 0 || ease[1] > 1 || ease[3] < 0 || ease[3] > 1);
|
|
1234
1243
|
var TRANSFORM_PROPS2 = ["x", "y", "rotation", "scaleX", "scaleY", "follow"];
|
|
1235
1244
|
var LINEAR_TRANSFORM = /* @__PURE__ */ new Set(["x", "y", "rotation", "scaleX", "scaleY"]);
|
|
1236
1245
|
function hex6(color) {
|
|
@@ -1240,6 +1249,7 @@ function hex6(color) {
|
|
|
1240
1249
|
function toFlairSvgMotion(scene, options = {}) {
|
|
1241
1250
|
const fps = options.fps ?? scene.fps ?? 30;
|
|
1242
1251
|
const precision = options.precision ?? 3;
|
|
1252
|
+
const curves = options.curves ?? true;
|
|
1243
1253
|
const round2 = (n) => Math.round(n * 10 ** precision) / 10 ** precision;
|
|
1244
1254
|
const f = (n) => String(round2(n));
|
|
1245
1255
|
const timeline = compileMotionScene(scene);
|
|
@@ -1269,6 +1279,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
1269
1279
|
attr: "transform",
|
|
1270
1280
|
segments: transformSegments,
|
|
1271
1281
|
exact: (s) => LINEAR_TRANSFORM.has(s.property) && !s.wave,
|
|
1282
|
+
overshoot: true,
|
|
1272
1283
|
value: (t) => {
|
|
1273
1284
|
const o = motionNodeOffset(entry, timeline, t, nodes);
|
|
1274
1285
|
return `translate(${f(o.dx)} ${f(o.dy)}) rotate(${f(o.rotation)} ${f(c.x)} ${f(c.y)}) translate(${f(c.x)} ${f(c.y)}) scale(${f(o.scaleX)} ${f(o.scaleY)}) translate(${f(-c.x)} ${f(-c.y)})${base}`;
|
|
@@ -1316,12 +1327,12 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
1316
1327
|
}
|
|
1317
1328
|
}
|
|
1318
1329
|
const camera = track("", "camera");
|
|
1319
|
-
if (camera.length) channels.push({ id: "", kind: "view", segments: [...camera], exact: () => true, value: (t) => trackValue(camera, t).map(round2) });
|
|
1330
|
+
if (camera.length) channels.push({ id: "", kind: "view", segments: [...camera], exact: () => true, overshoot: true, value: (t) => trackValue(camera, t).map(round2) });
|
|
1320
1331
|
const animate = [];
|
|
1321
1332
|
let sampled = 0;
|
|
1322
1333
|
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
1323
1334
|
const emit = (channel, delay, ms, from, to, ease) => {
|
|
1324
|
-
const base = { ...channel.id ? { id: channel.id } : {}, ...delay > 0 ? { delay: round2(delay) } : {}, ms: round2(ms), ease };
|
|
1335
|
+
const base = { ...channel.id ? { id: channel.id } : {}, ...delay > 0 ? { delay: round2(delay) } : {}, ms: round2(ms), ease: typeof ease === "string" ? ease : ease.map(round2) };
|
|
1325
1336
|
if (channel.kind === "view") animate.push({ ...base, view: to });
|
|
1326
1337
|
else if (channel.kind === "draw") animate.push({ ...base, draw: [from, to] });
|
|
1327
1338
|
else animate.push({ ...base, attrs: { [channel.attr]: [from, to] } });
|
|
@@ -1337,7 +1348,8 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
1337
1348
|
if (!active.length) continue;
|
|
1338
1349
|
const first = active[0];
|
|
1339
1350
|
const together = active.every((x) => x.start === a && x.end === b && channel.exact(x) && JSON.stringify(x.ease) === JSON.stringify(first.ease));
|
|
1340
|
-
const
|
|
1351
|
+
const curve = together ? flairCurveFor(first.ease, curves) : void 0;
|
|
1352
|
+
const ease = curve && (!overshoots(curve) || channel.overshoot) ? curve : void 0;
|
|
1341
1353
|
if (ease) {
|
|
1342
1354
|
const from = channel.value(a);
|
|
1343
1355
|
const to = channel.value(b);
|
|
@@ -1914,13 +1926,17 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
1914
1926
|
return { time: t, svg };
|
|
1915
1927
|
}
|
|
1916
1928
|
};
|
|
1929
|
+
const CURVES_DESCRIPTION = "Write cubic-bezier easings (ease, ease-in, ease-out, ease-in-out, back eases, custom curves) as one change with ease: [x1, y1, x2, y2] (default true). Needs Flair 0.36 or later; false samples them into linear steps for older Flair.";
|
|
1917
1930
|
const exportFlairMotion = {
|
|
1918
1931
|
name: "export_flair_motion",
|
|
1919
1932
|
title: "Export as Flair vector motion",
|
|
1920
1933
|
description: "Returns the animation as a Flair SvgMotion ({ svg, animate }) that Flair's SvgPlayer plays, plus its hold, how many changes were sampled into linear steps, and notes on anything not carried over.",
|
|
1921
|
-
inputSchema: object({
|
|
1934
|
+
inputSchema: object({
|
|
1935
|
+
fps: { type: "number", minimum: 1, maximum: 120, description: "Sampling rate for changes Flair cannot express exactly (default: the scene's fps, else 30)." },
|
|
1936
|
+
curves: { type: "boolean", description: CURVES_DESCRIPTION }
|
|
1937
|
+
}),
|
|
1922
1938
|
annotations: { title: "Export as Flair vector motion", ...READ },
|
|
1923
|
-
handler: ({ fps }) => controller.toFlairMotion(fps ? { fps } : {})
|
|
1939
|
+
handler: ({ fps, curves }) => controller.toFlairMotion({ ...fps ? { fps } : {}, ...curves === void 0 ? {} : { curves } })
|
|
1924
1940
|
};
|
|
1925
1941
|
const exportFlairEffect = {
|
|
1926
1942
|
name: "export_flair_effect",
|
|
@@ -1931,7 +1947,8 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
1931
1947
|
name: { type: "string", minLength: 1, description: "Display name (default: the scene's name)." },
|
|
1932
1948
|
description: { type: "string", description: "One sentence (default: the scene's description)." },
|
|
1933
1949
|
category: { type: "string", minLength: 1, description: "Flair catalog category, e.g. icon, loader, ui, data, text, morph (default icon)." },
|
|
1934
|
-
tags: { type: "array", items: { type: "string" }, description: "Search tags (default none)." }
|
|
1950
|
+
tags: { type: "array", items: { type: "string" }, description: "Search tags (default none)." },
|
|
1951
|
+
curves: { type: "boolean", description: CURVES_DESCRIPTION }
|
|
1935
1952
|
}),
|
|
1936
1953
|
annotations: { title: "Export as a Flair effect", ...READ },
|
|
1937
1954
|
handler: (args) => controller.toFlairEffect(args)
|
|
@@ -2186,6 +2203,7 @@ export {
|
|
|
2186
2203
|
describeMotionElements,
|
|
2187
2204
|
describeMotionShots,
|
|
2188
2205
|
fitMotionRect,
|
|
2206
|
+
flairCurveFor,
|
|
2189
2207
|
flairEaseFor,
|
|
2190
2208
|
freshShotId,
|
|
2191
2209
|
indexMotionNodes,
|