@open-pencil/scene-graph 0.18.0-beta.1 → 0.18.0-beta.2
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/arrow-caps.d.ts +14 -17
- package/dist/arrow-caps.d.ts.map +1 -1
- package/dist/arrow-caps.js +1 -2
- package/dist/asset-keys.d.ts +5 -8
- package/dist/asset-keys.d.ts.map +1 -1
- package/dist/asset-keys.js +2 -3
- package/dist/behaviours/index.d.ts +4 -3
- package/dist/behaviours/index.js +6 -5
- package/dist/behaviours/kinds.d.ts +38 -15
- package/dist/behaviours/kinds.d.ts.map +1 -1
- package/dist/behaviours/kinds.js +119 -4
- package/dist/behaviours/kinds.js.map +1 -1
- package/dist/behaviours/layers.d.ts +3 -6
- package/dist/behaviours/layers.d.ts.map +1 -1
- package/dist/behaviours/layers.js +1 -2
- package/dist/behaviours/listing.d.ts +58 -0
- package/dist/behaviours/listing.d.ts.map +1 -0
- package/dist/behaviours/listing.js +98 -0
- package/dist/behaviours/listing.js.map +1 -0
- package/dist/behaviours/model.d.ts +19 -16
- package/dist/behaviours/model.d.ts.map +1 -1
- package/dist/behaviours/model.js +14 -6
- package/dist/behaviours/model.js.map +1 -1
- package/dist/behaviours/schema.d.ts +16 -18
- package/dist/behaviours/schema.d.ts.map +1 -1
- package/dist/behaviours/schema.js +2 -3
- package/dist/behaviours/spec.d.ts +3 -6
- package/dist/behaviours/spec.d.ts.map +1 -1
- package/dist/behaviours/spec.js +4 -5
- package/dist/behaviours/transition.d.ts +6 -9
- package/dist/behaviours/transition.d.ts.map +1 -1
- package/dist/behaviours/transition.js +1 -2
- package/dist/bindings.js +2 -3
- package/dist/blur.d.ts +35 -0
- package/dist/blur.d.ts.map +1 -0
- package/dist/blur.js +69 -0
- package/dist/blur.js.map +1 -0
- package/dist/buffered-events.d.ts +3 -6
- package/dist/buffered-events.d.ts.map +1 -1
- package/dist/buffered-events.js +1 -2
- package/dist/buffered-events.js.map +1 -1
- package/dist/checkpoint.d.ts +3 -6
- package/dist/checkpoint.d.ts.map +1 -1
- package/dist/checkpoint.js +2 -3
- package/dist/clipping.d.ts +4 -7
- package/dist/clipping.d.ts.map +1 -1
- package/dist/clipping.js +4 -16
- package/dist/clipping.js.map +1 -1
- package/dist/color/contrast.d.ts +4 -7
- package/dist/color/contrast.d.ts.map +1 -1
- package/dist/color/contrast.js +2 -3
- package/dist/color/index.d.ts +13 -15
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.js +3 -4
- package/dist/color/management.d.ts +11 -14
- package/dist/color/management.d.ts.map +1 -1
- package/dist/color/management.js +2 -3
- package/dist/color/normalize.d.ts +1 -4
- package/dist/color/normalize.d.ts.map +1 -1
- package/dist/color/normalize.js +1 -2
- package/dist/color/okhcl.d.ts +16 -19
- package/dist/color/okhcl.d.ts.map +1 -1
- package/dist/color/okhcl.js +3 -4
- package/dist/color/schema.d.ts +4 -7
- package/dist/color/schema.d.ts.map +1 -1
- package/dist/color/schema.js +2 -3
- package/dist/comments/document.d.ts +3 -6
- package/dist/comments/document.d.ts.map +1 -1
- package/dist/comments/document.js +1 -2
- package/dist/comments/index.js +2 -2
- package/dist/comments/list.d.ts +5 -8
- package/dist/comments/list.d.ts.map +1 -1
- package/dist/comments/list.js +1 -2
- package/dist/comments/merge.d.ts +2 -5
- package/dist/comments/merge.d.ts.map +1 -1
- package/dist/comments/merge.js +1 -2
- package/dist/comments/schema.d.ts +2 -5
- package/dist/comments/schema.d.ts.map +1 -1
- package/dist/comments/schema.js +1 -2
- package/dist/comments/threads.d.ts +16 -19
- package/dist/comments/threads.d.ts.map +1 -1
- package/dist/comments/threads.js +8 -3
- package/dist/comments/threads.js.map +1 -1
- package/dist/components/exposure.d.ts +4 -7
- package/dist/components/exposure.d.ts.map +1 -1
- package/dist/components/exposure.js +1 -2
- package/dist/components/properties.d.ts +13 -16
- package/dist/components/properties.d.ts.map +1 -1
- package/dist/components/properties.js +3 -4
- package/dist/components/variants.d.ts +5 -8
- package/dist/components/variants.d.ts.map +1 -1
- package/dist/components/variants.js +1 -2
- package/dist/connectors/controls.d.ts +6 -9
- package/dist/connectors/controls.d.ts.map +1 -1
- package/dist/connectors/controls.js +2 -3
- package/dist/connectors/create.d.ts +3 -6
- package/dist/connectors/create.d.ts.map +1 -1
- package/dist/connectors/create.js +2 -3
- package/dist/connectors/elbow.js +0 -1
- package/dist/connectors/gaps.d.ts +1 -4
- package/dist/connectors/gaps.d.ts.map +1 -1
- package/dist/connectors/gaps.js +1 -2
- package/dist/connectors/hit.d.ts +1 -4
- package/dist/connectors/hit.d.ts.map +1 -1
- package/dist/connectors/hit.js +3 -4
- package/dist/connectors/index.d.ts +3 -3
- package/dist/connectors/index.js +6 -6
- package/dist/connectors/label.d.ts +4 -7
- package/dist/connectors/label.d.ts.map +1 -1
- package/dist/connectors/label.js +1 -2
- package/dist/connectors/layout.d.ts +8 -10
- package/dist/connectors/layout.d.ts.map +1 -1
- package/dist/connectors/layout.js +12 -10
- package/dist/connectors/layout.js.map +1 -1
- package/dist/connectors/pieces.d.ts +2 -5
- package/dist/connectors/pieces.d.ts.map +1 -1
- package/dist/connectors/pieces.js +3 -4
- package/dist/connectors/pieces.js.map +1 -1
- package/dist/connectors/route.d.ts +2 -5
- package/dist/connectors/route.d.ts.map +1 -1
- package/dist/connectors/route.js +4 -5
- package/dist/connectors/sides.d.ts +3 -6
- package/dist/connectors/sides.d.ts.map +1 -1
- package/dist/connectors/sides.js +2 -3
- package/dist/connectors/sublayers.d.ts +21 -24
- package/dist/connectors/sublayers.d.ts.map +1 -1
- package/dist/connectors/sublayers.js +3 -3
- package/dist/connectors/sublayers.js.map +1 -1
- package/dist/constants.d.ts +13 -16
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -2
- package/dist/constraints.d.ts +6 -8
- package/dist/constraints.d.ts.map +1 -1
- package/dist/constraints.js +1 -2
- package/dist/coordinate.d.ts +27 -29
- package/dist/coordinate.d.ts.map +1 -1
- package/dist/coordinate.js +19 -38
- package/dist/coordinate.js.map +1 -1
- package/dist/copy.d.ts +31 -25
- package/dist/copy.d.ts.map +1 -1
- package/dist/copy.js +13 -5
- package/dist/copy.js.map +1 -1
- package/dist/corners.d.ts +8 -10
- package/dist/corners.d.ts.map +1 -1
- package/dist/corners.js +1 -2
- package/dist/css/blend.d.ts +1 -4
- package/dist/css/blend.d.ts.map +1 -1
- package/dist/css/blend.js +1 -2
- package/dist/css/grid.d.ts +1 -4
- package/dist/css/grid.d.ts.map +1 -1
- package/dist/css/grid.js +4 -5
- package/dist/css/index.js +2 -2
- package/dist/css/layout.d.ts +7 -10
- package/dist/css/layout.d.ts.map +1 -1
- package/dist/css/layout.js +2 -3
- package/dist/css/motion.d.ts +2 -5
- package/dist/css/motion.d.ts.map +1 -1
- package/dist/css/motion.js +2 -3
- package/dist/css/shadows.d.ts +1 -4
- package/dist/css/shadows.d.ts.map +1 -1
- package/dist/css/shadows.js +3 -4
- package/dist/css/text.d.ts +8 -11
- package/dist/css/text.d.ts.map +1 -1
- package/dist/css/text.js +1 -2
- package/dist/css/transform.d.ts +6 -9
- package/dist/css/transform.d.ts.map +1 -1
- package/dist/css/transform.js +2 -3
- package/dist/css/values.d.ts +9 -12
- package/dist/css/values.d.ts.map +1 -1
- package/dist/css/values.js +2 -3
- package/dist/cubic.d.ts +11 -5
- package/dist/cubic.d.ts.map +1 -1
- package/dist/cubic.js +71 -3
- package/dist/cubic.js.map +1 -1
- package/dist/events.js +1 -2
- package/dist/export-format.d.ts +5 -8
- package/dist/export-format.d.ts.map +1 -1
- package/dist/export-format.js +4 -3
- package/dist/export-format.js.map +1 -1
- package/dist/export-scale.d.ts +4 -7
- package/dist/export-scale.d.ts.map +1 -1
- package/dist/export-scale.js +1 -2
- package/dist/fields/appearance.d.ts +3 -6
- package/dist/fields/appearance.d.ts.map +1 -1
- package/dist/fields/appearance.js +1 -2
- package/dist/fields/geometry.d.ts +2 -5
- package/dist/fields/geometry.d.ts.map +1 -1
- package/dist/fields/geometry.js +1 -2
- package/dist/fields/index.js +1 -1
- package/dist/fields/layout.d.ts +4 -7
- package/dist/fields/layout.d.ts.map +1 -1
- package/dist/fields/layout.js +1 -2
- package/dist/fields/text.d.ts +5 -8
- package/dist/fields/text.d.ts.map +1 -1
- package/dist/fields/text.js +1 -2
- package/dist/fig-compression.d.ts +3 -6
- package/dist/fig-compression.d.ts.map +1 -1
- package/dist/fig-compression.js +1 -2
- package/dist/figjam/index.js +1 -1
- package/dist/figjam/palette.d.ts +21 -23
- package/dist/figjam/palette.d.ts.map +1 -1
- package/dist/figjam/palette.js +3 -4
- package/dist/figjam/text.d.ts +10 -13
- package/dist/figjam/text.d.ts.map +1 -1
- package/dist/figjam/text.js +1 -2
- package/dist/font-style.d.ts +18 -18
- package/dist/font-style.d.ts.map +1 -1
- package/dist/font-style.js +5 -5
- package/dist/font-style.js.map +1 -1
- package/dist/generated/index.d.ts +32 -16
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +37 -9
- package/dist/generated/index.js.map +1 -1
- package/dist/generated/kind.d.ts +17 -6
- package/dist/generated/kind.d.ts.map +1 -1
- package/dist/generated/shape-with-text.d.ts +10 -13
- package/dist/generated/shape-with-text.d.ts.map +1 -1
- package/dist/generated/shape-with-text.js +3 -3
- package/dist/generated/shape-with-text.js.map +1 -1
- package/dist/generated/spec.d.ts +45 -0
- package/dist/generated/spec.d.ts.map +1 -0
- package/dist/generated/spec.js +281 -0
- package/dist/generated/spec.js.map +1 -0
- package/dist/generated/sticky.d.ts +23 -26
- package/dist/generated/sticky.d.ts.map +1 -1
- package/dist/generated/sticky.js +4 -4
- package/dist/generated/sticky.js.map +1 -1
- package/dist/geometry.d.ts +43 -69
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +44 -76
- package/dist/geometry.js.map +1 -1
- package/dist/gradient.d.ts +15 -18
- package/dist/gradient.d.ts.map +1 -1
- package/dist/gradient.js +1 -2
- package/dist/graph.d.ts +4 -7
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +26 -19
- package/dist/graph.js.map +1 -1
- package/dist/group-bounds.d.ts +10 -12
- package/dist/group-bounds.d.ts.map +1 -1
- package/dist/group-bounds.js +5 -6
- package/dist/guides.d.ts +5 -8
- package/dist/guides.d.ts.map +1 -1
- package/dist/guides.js +2 -3
- package/dist/hit-test.d.ts +20 -12
- package/dist/hit-test.d.ts.map +1 -1
- package/dist/hit-test.js +51 -31
- package/dist/hit-test.js.map +1 -1
- package/dist/icons/fit.d.ts +2 -4
- package/dist/icons/fit.d.ts.map +1 -1
- package/dist/icons/fit.js +1 -2
- package/dist/icons/glyph.d.ts +3 -5
- package/dist/icons/glyph.d.ts.map +1 -1
- package/dist/icons/glyph.js +3 -4
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +2 -2
- package/dist/icons/model.d.ts +8 -11
- package/dist/icons/model.d.ts.map +1 -1
- package/dist/icons/model.js +1 -2
- package/dist/icons/schema.d.ts +8 -11
- package/dist/icons/schema.d.ts.map +1 -1
- package/dist/icons/schema.js +1 -2
- package/dist/ids.d.ts +2 -5
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +3 -4
- package/dist/images.d.ts +20 -21
- package/dist/images.d.ts.map +1 -1
- package/dist/images.js +7 -6
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/instances/assignments.js +1 -2
- package/dist/instances/content-marks.js +98 -0
- package/dist/instances/content-marks.js.map +1 -0
- package/dist/instances/content-size.js +3 -4
- package/dist/instances/copies.js +2 -3
- package/dist/instances/cycles.d.ts +3 -6
- package/dist/instances/cycles.d.ts.map +1 -1
- package/dist/instances/cycles.js +1 -2
- package/dist/instances/deleted.d.ts +23 -0
- package/dist/instances/deleted.d.ts.map +1 -0
- package/dist/instances/deleted.js +82 -0
- package/dist/instances/deleted.js.map +1 -0
- package/dist/instances/fields.d.ts +5 -8
- package/dist/instances/fields.d.ts.map +1 -1
- package/dist/instances/fields.js +9 -7
- package/dist/instances/fields.js.map +1 -1
- package/dist/instances/index.d.ts +21 -20
- package/dist/instances/index.d.ts.map +1 -1
- package/dist/instances/index.js +69 -12
- package/dist/instances/index.js.map +1 -1
- package/dist/instances/kept-overrides.js +4 -5
- package/dist/instances/lookup.d.ts +17 -0
- package/dist/instances/lookup.d.ts.map +1 -0
- package/dist/instances/lookup.js +48 -0
- package/dist/instances/lookup.js.map +1 -0
- package/dist/instances/main-component.d.ts +2 -5
- package/dist/instances/main-component.d.ts.map +1 -1
- package/dist/instances/main-component.js +1 -2
- package/dist/instances/matching.js +1 -2
- package/dist/instances/overrides.d.ts +23 -26
- package/dist/instances/overrides.d.ts.map +1 -1
- package/dist/instances/overrides.js +1 -2
- package/dist/instances/placement.js +3 -4
- package/dist/instances/protection.js +3 -4
- package/dist/instances/source-walk.js +1 -2
- package/dist/instances/swap.js +7 -8
- package/dist/instances/sync.js +27 -14
- package/dist/instances/sync.js.map +1 -1
- package/dist/instances/vector-geometry.js +2 -3
- package/dist/layout/aspect-ratio.d.ts +7 -9
- package/dist/layout/aspect-ratio.d.ts.map +1 -1
- package/dist/layout/aspect-ratio.js +1 -2
- package/dist/layout/flow.d.ts +3 -6
- package/dist/layout/flow.d.ts.map +1 -1
- package/dist/layout/flow.js +6 -5
- package/dist/layout/flow.js.map +1 -1
- package/dist/layout/guides.d.ts +13 -16
- package/dist/layout/guides.d.ts.map +1 -1
- package/dist/layout/guides.js +4 -5
- package/dist/layout/guides.js.map +1 -1
- package/dist/layout/index.d.ts +3 -2
- package/dist/layout/index.js +6 -5
- package/dist/layout/keywords.d.ts +7 -9
- package/dist/layout/keywords.d.ts.map +1 -1
- package/dist/layout/keywords.js +1 -2
- package/dist/layout/limits.d.ts +13 -16
- package/dist/layout/limits.d.ts.map +1 -1
- package/dist/layout/limits.js +1 -2
- package/dist/layout/sizing.d.ts +11 -13
- package/dist/layout/sizing.d.ts.map +1 -1
- package/dist/layout/sizing.js +1 -2
- package/dist/layout/spacing.d.ts +2 -5
- package/dist/layout/spacing.d.ts.map +1 -1
- package/dist/layout/spacing.js +1 -2
- package/dist/layout/stacking.d.ts +8 -0
- package/dist/layout/stacking.d.ts.map +1 -0
- package/dist/layout/stacking.js +12 -0
- package/dist/layout/stacking.js.map +1 -0
- package/dist/layout/strokes.d.ts +1 -4
- package/dist/layout/strokes.d.ts.map +1 -1
- package/dist/layout/strokes.js +1 -2
- package/dist/layout/writes.js +1 -2
- package/dist/layout/writes.js.map +1 -1
- package/dist/masks.d.ts +4 -7
- package/dist/masks.d.ts.map +1 -1
- package/dist/masks.js +1 -2
- package/dist/matrix.d.ts +3 -4
- package/dist/matrix.d.ts.map +1 -1
- package/dist/matrix.js +11 -3
- package/dist/matrix.js.map +1 -1
- package/dist/mesh/geometry.d.ts +21 -24
- package/dist/mesh/geometry.d.ts.map +1 -1
- package/dist/mesh/geometry.js +3 -14
- package/dist/mesh/geometry.js.map +1 -1
- package/dist/mesh/index.d.ts +1 -1
- package/dist/mesh/index.js +1 -1
- package/dist/mesh/model.d.ts +5 -8
- package/dist/mesh/model.d.ts.map +1 -1
- package/dist/mesh/model.js +2 -3
- package/dist/mesh/schema.d.ts +10 -13
- package/dist/mesh/schema.d.ts.map +1 -1
- package/dist/mesh/schema.js +3 -4
- package/dist/motion/apply.d.ts +42 -0
- package/dist/motion/apply.d.ts.map +1 -0
- package/dist/motion/apply.js +98 -0
- package/dist/motion/apply.js.map +1 -0
- package/dist/motion/edit.d.ts +53 -0
- package/dist/motion/edit.d.ts.map +1 -0
- package/dist/motion/edit.js +125 -0
- package/dist/motion/edit.js.map +1 -0
- package/dist/motion/effects.js +86 -0
- package/dist/motion/effects.js.map +1 -0
- package/dist/motion/evaluate.d.ts +33 -0
- package/dist/motion/evaluate.d.ts.map +1 -0
- package/dist/motion/evaluate.js +160 -0
- package/dist/motion/evaluate.js.map +1 -0
- package/dist/motion/fields.d.ts +69 -0
- package/dist/motion/fields.d.ts.map +1 -0
- package/dist/motion/fields.js +132 -0
- package/dist/motion/fields.js.map +1 -0
- package/dist/motion/index.d.ts +16 -0
- package/dist/motion/index.js +15 -0
- package/dist/motion/keyable.d.ts +32 -0
- package/dist/motion/keyable.d.ts.map +1 -0
- package/dist/motion/keyable.js +120 -0
- package/dist/motion/keyable.js.map +1 -0
- package/dist/motion/outline.d.ts +35 -0
- package/dist/motion/outline.d.ts.map +1 -0
- package/dist/motion/outline.js +59 -0
- package/dist/motion/outline.js.map +1 -0
- package/dist/motion/presets/index.d.ts +20 -0
- package/dist/motion/presets/index.d.ts.map +1 -0
- package/dist/motion/presets/index.js +166 -0
- package/dist/motion/presets/index.js.map +1 -0
- package/dist/motion/presets/settings.d.ts +43 -0
- package/dist/motion/presets/settings.d.ts.map +1 -0
- package/dist/motion/presets/settings.js +254 -0
- package/dist/motion/presets/settings.js.map +1 -0
- package/dist/motion/presets/stagger.d.ts +69 -0
- package/dist/motion/presets/stagger.d.ts.map +1 -0
- package/dist/motion/presets/stagger.js +185 -0
- package/dist/motion/presets/stagger.js.map +1 -0
- package/dist/motion/schema.d.ts +185 -0
- package/dist/motion/schema.d.ts.map +1 -0
- package/dist/motion/schema.js +62 -0
- package/dist/motion/schema.js.map +1 -0
- package/dist/motion/segment.d.ts +25 -0
- package/dist/motion/segment.d.ts.map +1 -0
- package/dist/motion/segment.js +73 -0
- package/dist/motion/segment.js.map +1 -0
- package/dist/motion/spec.d.ts +26 -0
- package/dist/motion/spec.d.ts.map +1 -0
- package/dist/motion/spec.js +175 -0
- package/dist/motion/spec.js.map +1 -0
- package/dist/motion/timeline.d.ts +16 -0
- package/dist/motion/timeline.d.ts.map +1 -0
- package/dist/motion/timeline.js +53 -0
- package/dist/motion/timeline.js.map +1 -0
- package/dist/motion/types.d.ts +49 -0
- package/dist/motion/types.d.ts.map +1 -0
- package/dist/motion/variables.d.ts +9 -0
- package/dist/motion/variables.d.ts.map +1 -0
- package/dist/motion/variables.js +25 -0
- package/dist/motion/variables.js.map +1 -0
- package/dist/mutation-impact.d.ts +7 -10
- package/dist/mutation-impact.d.ts.map +1 -1
- package/dist/mutation-impact.js +2 -3
- package/dist/node-defaults.d.ts +14 -15
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +133 -51
- package/dist/node-defaults.js.map +1 -1
- package/dist/order-keys.d.ts +8 -9
- package/dist/order-keys.d.ts.map +1 -1
- package/dist/order-keys.js +10 -2
- package/dist/order-keys.js.map +1 -1
- package/dist/outline/flatten.d.ts +3 -6
- package/dist/outline/flatten.d.ts.map +1 -1
- package/dist/outline/flatten.js +3 -4
- package/dist/outline/heads.js +1 -2
- package/dist/outline/hit.d.ts +2 -5
- package/dist/outline/hit.d.ts.map +1 -1
- package/dist/outline/hit.js +5 -6
- package/dist/outline/index.js +3 -3
- package/dist/outline/point.d.ts +4 -7
- package/dist/outline/point.d.ts.map +1 -1
- package/dist/outline/point.js +2 -3
- package/dist/outline/shapes.d.ts +4 -7
- package/dist/outline/shapes.d.ts.map +1 -1
- package/dist/outline/shapes.js +2 -3
- package/dist/paints/index.d.ts +2 -2
- package/dist/paints/index.js +4 -4
- package/dist/paints/pattern.d.ts +6 -9
- package/dist/paints/pattern.d.ts.map +1 -1
- package/dist/paints/pattern.js +1 -2
- package/dist/paints/schema.d.ts +4 -7
- package/dist/paints/schema.d.ts.map +1 -1
- package/dist/paints/schema.js +3 -4
- package/dist/paints/shows.d.ts +3 -6
- package/dist/paints/shows.d.ts.map +1 -1
- package/dist/paints/shows.js +1 -2
- package/dist/paints/solid.d.ts +1 -4
- package/dist/paints/solid.d.ts.map +1 -1
- package/dist/paints/solid.js +1 -2
- package/dist/paints/stills.d.ts +17 -17
- package/dist/paints/stills.d.ts.map +1 -1
- package/dist/paints/stills.js +22 -18
- package/dist/paints/stills.js.map +1 -1
- package/dist/parse-path.d.ts +12 -9
- package/dist/parse-path.d.ts.map +1 -1
- package/dist/parse-path.js +13 -3
- package/dist/parse-path.js.map +1 -1
- package/dist/paths/arc.d.ts +6 -9
- package/dist/paths/arc.d.ts.map +1 -1
- package/dist/paths/arc.js +1 -2
- package/dist/paths/index.d.ts +1 -1
- package/dist/paths/index.js +1 -1
- package/dist/paths/network.d.ts +13 -16
- package/dist/paths/network.d.ts.map +1 -1
- package/dist/paths/network.js +1 -2
- package/dist/paths/sink.d.ts +5 -8
- package/dist/paths/sink.d.ts.map +1 -1
- package/dist/paths/sink.js +1 -2
- package/dist/paths/smooth-corners.d.ts +3 -6
- package/dist/paths/smooth-corners.d.ts.map +1 -1
- package/dist/paths/smooth-corners.js +1 -2
- package/dist/plugin-data/field.d.ts +15 -18
- package/dist/plugin-data/field.d.ts.map +1 -1
- package/dist/plugin-data/field.js +1 -2
- package/dist/plugin-data/fields.d.ts +37 -11
- package/dist/plugin-data/fields.d.ts.map +1 -1
- package/dist/plugin-data/fields.js +35 -10
- package/dist/plugin-data/fields.js.map +1 -1
- package/dist/plugin-data/index.d.ts +2 -2
- package/dist/plugin-data/index.js +2 -2
- package/dist/polygon.d.ts +8 -8
- package/dist/polygon.d.ts.map +1 -1
- package/dist/polygon.js +7 -7
- package/dist/polygon.js.map +1 -1
- package/dist/preview.d.ts +3 -5
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +2 -3
- package/dist/primitives/index.d.ts +7 -9
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +1 -2
- package/dist/primitives/schema.d.ts +3 -6
- package/dist/primitives/schema.d.ts.map +1 -1
- package/dist/primitives/schema.js +1 -2
- package/dist/resize.d.ts +13 -15
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +5 -6
- package/dist/scaling/node.d.ts +2 -5
- package/dist/scaling/node.d.ts.map +1 -1
- package/dist/scaling/node.js +4 -5
- package/dist/scaling/snapshot.d.ts +5 -8
- package/dist/scaling/snapshot.d.ts.map +1 -1
- package/dist/scaling/snapshot.js +1 -2
- package/dist/scaling/tree.d.ts +6 -9
- package/dist/scaling/tree.d.ts.map +1 -1
- package/dist/scaling/tree.js +2 -3
- package/dist/shaders/index.d.ts +2 -2
- package/dist/shaders/index.js +2 -2
- package/dist/shaders/model.d.ts +54 -13
- package/dist/shaders/model.d.ts.map +1 -1
- package/dist/shaders/model.js +98 -7
- package/dist/shaders/model.js.map +1 -1
- package/dist/shaders/schema.d.ts +15 -8
- package/dist/shaders/schema.d.ts.map +1 -1
- package/dist/shaders/schema.js +11 -2
- package/dist/shaders/schema.js.map +1 -1
- package/dist/shape-with-text/document.js +9 -21
- package/dist/shape-with-text/document.js.map +1 -1
- package/dist/shape-with-text/fit.d.ts +6 -9
- package/dist/shape-with-text/fit.d.ts.map +1 -1
- package/dist/shape-with-text/fit.js +1 -2
- package/dist/shape-with-text/geometry.d.ts +7 -10
- package/dist/shape-with-text/geometry.d.ts.map +1 -1
- package/dist/shape-with-text/geometry.js +4 -7
- package/dist/shape-with-text/geometry.js.map +1 -1
- package/dist/shape-with-text/index.js +1 -1
- package/dist/shape-with-text/kinds.d.ts +4 -7
- package/dist/shape-with-text/kinds.d.ts.map +1 -1
- package/dist/shape-with-text/kinds.js +1 -2
- package/dist/shared-style-index.d.ts +2 -4
- package/dist/shared-style-index.d.ts.map +1 -1
- package/dist/shared-style-index.js +1 -2
- package/dist/shared-style-index.js.map +1 -1
- package/dist/shared-styles.d.ts +17 -19
- package/dist/shared-styles.d.ts.map +1 -1
- package/dist/shared-styles.js +5 -6
- package/dist/slides/drop.d.ts +5 -8
- package/dist/slides/drop.d.ts.map +1 -1
- package/dist/slides/drop.js +1 -2
- package/dist/slides/index.d.ts +19 -19
- package/dist/slides/index.d.ts.map +1 -1
- package/dist/slides/index.js +8 -5
- package/dist/slides/index.js.map +1 -1
- package/dist/slides/motion.d.ts +32 -16
- package/dist/slides/motion.d.ts.map +1 -1
- package/dist/slides/motion.js +30 -5
- package/dist/slides/motion.js.map +1 -1
- package/dist/slides/playback.d.ts +24 -21
- package/dist/slides/playback.d.ts.map +1 -1
- package/dist/slides/playback.js +45 -13
- package/dist/slides/playback.js.map +1 -1
- package/dist/slides/types.d.ts +8 -11
- package/dist/slides/types.d.ts.map +1 -1
- package/dist/slides/types.js +1 -2
- package/dist/slots/authoring.d.ts +6 -9
- package/dist/slots/authoring.d.ts.map +1 -1
- package/dist/slots/authoring.js +2 -3
- package/dist/slots/content.d.ts +5 -8
- package/dist/slots/content.d.ts.map +1 -1
- package/dist/slots/content.js +4 -5
- package/dist/slots/frames.d.ts +7 -9
- package/dist/slots/frames.d.ts.map +1 -1
- package/dist/slots/frames.js +3 -4
- package/dist/slots/frames.js.map +1 -1
- package/dist/slots/index.js +1 -1
- package/dist/slots/limits.d.ts +4 -7
- package/dist/slots/limits.d.ts.map +1 -1
- package/dist/slots/limits.js +1 -2
- package/dist/snap.d.ts +4 -7
- package/dist/snap.d.ts.map +1 -1
- package/dist/snap.js +7 -8
- package/dist/source-metadata.d.ts +1 -4
- package/dist/source-metadata.d.ts.map +1 -1
- package/dist/source-metadata.js +1 -2
- package/dist/specs/index.d.ts +3 -0
- package/dist/specs/index.js +3 -0
- package/dist/specs/model.d.ts +20 -0
- package/dist/specs/model.d.ts.map +1 -0
- package/dist/specs/model.js +32 -0
- package/dist/specs/model.js.map +1 -0
- package/dist/specs/schema.d.ts +24 -0
- package/dist/specs/schema.d.ts.map +1 -0
- package/dist/specs/schema.js +32 -0
- package/dist/specs/schema.js.map +1 -0
- package/dist/statuses/impact.d.ts +2 -5
- package/dist/statuses/impact.d.ts.map +1 -1
- package/dist/statuses/impact.js +2 -3
- package/dist/statuses/index.d.ts +1 -1
- package/dist/statuses/index.js +2 -2
- package/dist/statuses/node.d.ts +4 -7
- package/dist/statuses/node.d.ts.map +1 -1
- package/dist/statuses/node.js +1 -2
- package/dist/statuses/schema.d.ts +7 -9
- package/dist/statuses/schema.d.ts.map +1 -1
- package/dist/statuses/schema.js +1 -2
- package/dist/statuses/workflow.d.ts +9 -12
- package/dist/statuses/workflow.d.ts.map +1 -1
- package/dist/statuses/workflow.js +1 -2
- package/dist/strokes.d.ts +8 -10
- package/dist/strokes.d.ts.map +1 -1
- package/dist/strokes.js +2 -3
- package/dist/text/auto-resize.d.ts +4 -6
- package/dist/text/auto-resize.d.ts.map +1 -1
- package/dist/text/auto-resize.js +1 -2
- package/dist/text/direction.d.ts +5 -8
- package/dist/text/direction.d.ts.map +1 -1
- package/dist/text/direction.js +1 -2
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.js +5 -5
- package/dist/text/lengths.d.ts +9 -12
- package/dist/text/lengths.d.ts.map +1 -1
- package/dist/text/lengths.js +1 -2
- package/dist/text/lists.d.ts +17 -13
- package/dist/text/lists.d.ts.map +1 -1
- package/dist/text/lists.js +15 -4
- package/dist/text/lists.js.map +1 -1
- package/dist/text/name.d.ts +4 -7
- package/dist/text/name.d.ts.map +1 -1
- package/dist/text/name.js +1 -2
- package/dist/text/overflow.d.ts +5 -7
- package/dist/text/overflow.d.ts.map +1 -1
- package/dist/text/overflow.js +1 -2
- package/dist/text/paragraphs.d.ts +20 -23
- package/dist/text/paragraphs.d.ts.map +1 -1
- package/dist/text/paragraphs.js +8 -5
- package/dist/text/paragraphs.js.map +1 -1
- package/dist/text/path.js +1 -2
- package/dist/text/picture.d.ts +3 -6
- package/dist/text/picture.d.ts.map +1 -1
- package/dist/text/picture.js +2 -3
- package/dist/text/references.d.ts +3 -6
- package/dist/text/references.d.ts.map +1 -1
- package/dist/text/references.js +1 -2
- package/dist/text/runs.d.ts +6 -9
- package/dist/text/runs.d.ts.map +1 -1
- package/dist/text/runs.js +1 -2
- package/dist/text/schema.d.ts +1 -4
- package/dist/text/schema.d.ts.map +1 -1
- package/dist/text/schema.js +1 -2
- package/dist/thumbnail.d.ts +4 -7
- package/dist/thumbnail.d.ts.map +1 -1
- package/dist/thumbnail.js +1 -2
- package/dist/transfer/apply.d.ts +2 -5
- package/dist/transfer/apply.d.ts.map +1 -1
- package/dist/transfer/apply.js +2 -3
- package/dist/transfer/copied.d.ts +5 -8
- package/dist/transfer/copied.d.ts.map +1 -1
- package/dist/transfer/copied.js +3 -4
- package/dist/transfer/dependencies.d.ts +6 -9
- package/dist/transfer/dependencies.d.ts.map +1 -1
- package/dist/transfer/dependencies.js +13 -11
- package/dist/transfer/dependencies.js.map +1 -1
- package/dist/transfer/history.d.ts +1 -4
- package/dist/transfer/history.d.ts.map +1 -1
- package/dist/transfer/history.js +1 -2
- package/dist/transfer/identity.js +1 -2
- package/dist/transfer/index.d.ts +3 -3
- package/dist/transfer/index.js +6 -6
- package/dist/transfer/library.d.ts +5 -7
- package/dist/transfer/library.d.ts.map +1 -1
- package/dist/transfer/library.js +32 -12
- package/dist/transfer/library.js.map +1 -1
- package/dist/transfer/nodes.d.ts +2 -5
- package/dist/transfer/nodes.d.ts.map +1 -1
- package/dist/transfer/nodes.js +8 -6
- package/dist/transfer/nodes.js.map +1 -1
- package/dist/transfer/plan.d.ts +2 -5
- package/dist/transfer/plan.d.ts.map +1 -1
- package/dist/transfer/plan.js +2 -3
- package/dist/transfer/references.js +1 -2
- package/dist/transfer/remove.d.ts +1 -4
- package/dist/transfer/remove.d.ts.map +1 -1
- package/dist/transfer/remove.js +2 -3
- package/dist/transfer/resources.d.ts +2 -5
- package/dist/transfer/resources.d.ts.map +1 -1
- package/dist/transfer/resources.js +3 -4
- package/dist/transfer/validation.js +1 -2
- package/dist/transfer/variables.d.ts +3 -6
- package/dist/transfer/variables.d.ts.map +1 -1
- package/dist/transfer/variables.js +2 -3
- package/dist/types.d.ts +191 -142
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -3
- package/dist/types.js.map +1 -1
- package/dist/undo.d.ts +5 -8
- package/dist/undo.d.ts.map +1 -1
- package/dist/undo.js +9 -3
- package/dist/undo.js.map +1 -1
- package/dist/variables/bindings.d.ts +24 -25
- package/dist/variables/bindings.d.ts.map +1 -1
- package/dist/variables/bindings.js +28 -23
- package/dist/variables/bindings.js.map +1 -1
- package/dist/variables/corners.d.ts +1 -4
- package/dist/variables/corners.d.ts.map +1 -1
- package/dist/variables/corners.js +1 -2
- package/dist/variables/easing.d.ts +24 -19
- package/dist/variables/easing.d.ts.map +1 -1
- package/dist/variables/easing.js +17 -17
- package/dist/variables/easing.js.map +1 -1
- package/dist/variables/fields.d.ts +21 -14
- package/dist/variables/fields.d.ts.map +1 -1
- package/dist/variables/fields.js +24 -6
- package/dist/variables/fields.js.map +1 -1
- package/dist/variables/formula/check.d.ts +2 -5
- package/dist/variables/formula/check.d.ts.map +1 -1
- package/dist/variables/formula/check.js +2 -3
- package/dist/variables/formula/evaluate.d.ts +1 -4
- package/dist/variables/formula/evaluate.d.ts.map +1 -1
- package/dist/variables/formula/evaluate.js +3 -4
- package/dist/variables/formula/index.d.ts +6 -8
- package/dist/variables/formula/index.d.ts.map +1 -1
- package/dist/variables/formula/index.js +4 -5
- package/dist/variables/formula/parse.js +5 -6
- package/dist/variables/formula/print.d.ts +2 -5
- package/dist/variables/formula/print.d.ts.map +1 -1
- package/dist/variables/formula/print.js +4 -5
- package/dist/variables/formula/schema.d.ts +2 -5
- package/dist/variables/formula/schema.d.ts.map +1 -1
- package/dist/variables/formula/schema.js +5 -6
- package/dist/variables/formula/signatures.d.ts +3 -6
- package/dist/variables/formula/signatures.d.ts.map +1 -1
- package/dist/variables/formula/signatures.js +1 -2
- package/dist/variables/formula/tokens.d.ts +5 -8
- package/dist/variables/formula/tokens.d.ts.map +1 -1
- package/dist/variables/formula/tokens.js +1 -2
- package/dist/variables/formula/tree.d.ts +6 -9
- package/dist/variables/formula/tree.d.ts.map +1 -1
- package/dist/variables/formula/tree.js +1 -2
- package/dist/variables/formula/tree.js.map +1 -1
- package/dist/variables/index.d.ts +30 -32
- package/dist/variables/index.d.ts.map +1 -1
- package/dist/variables/index.js +17 -18
- package/dist/variables/lookup.d.ts +11 -7
- package/dist/variables/lookup.d.ts.map +1 -1
- package/dist/variables/lookup.js +24 -3
- package/dist/variables/lookup.js.map +1 -1
- package/dist/variables/motion.d.ts +9 -12
- package/dist/variables/motion.d.ts.map +1 -1
- package/dist/variables/motion.js +3 -4
- package/dist/variables/paints.d.ts +18 -20
- package/dist/variables/paints.d.ts.map +1 -1
- package/dist/variables/paints.js +4 -5
- package/dist/variables/resolution.d.ts +22 -19
- package/dist/variables/resolution.d.ts.map +1 -1
- package/dist/variables/resolution.js +13 -5
- package/dist/variables/resolution.js.map +1 -1
- package/dist/variables/schema.d.ts +9 -12
- package/dist/variables/schema.d.ts.map +1 -1
- package/dist/variables/schema.js +3 -4
- package/dist/variables/style-bindings.d.ts +11 -13
- package/dist/variables/style-bindings.d.ts.map +1 -1
- package/dist/variables/style-bindings.js +2 -3
- package/dist/variables/subtree.js +1 -2
- package/dist/variables/text.d.ts +2 -5
- package/dist/variables/text.d.ts.map +1 -1
- package/dist/variables/text.js +3 -4
- package/dist/variables/token.d.ts +5 -8
- package/dist/variables/token.d.ts.map +1 -1
- package/dist/variables/token.js +1 -2
- package/dist/variables/units.js +3 -5
- package/dist/variables/units.js.map +1 -1
- package/dist/variables/value.d.ts +4 -7
- package/dist/variables/value.d.ts.map +1 -1
- package/dist/variables/value.js +4 -5
- package/dist/variant-name.d.ts +2 -5
- package/dist/variant-name.d.ts.map +1 -1
- package/dist/variant-name.js +1 -2
- package/dist/variant-properties.d.ts +4 -7
- package/dist/variant-properties.d.ts.map +1 -1
- package/dist/variant-properties.js +2 -3
- package/dist/vector-network.d.ts +17 -20
- package/dist/vector-network.d.ts.map +1 -1
- package/dist/vector-network.js +4 -5
- package/package.json +23 -5
- package/src/behaviours/index.ts +1 -0
- package/src/behaviours/kinds.ts +103 -1
- package/src/behaviours/listing.ts +142 -0
- package/src/behaviours/model.ts +21 -0
- package/src/blur.ts +88 -0
- package/src/clipping.ts +3 -4
- package/src/comments/threads.ts +8 -1
- package/src/connectors/layout.ts +10 -3
- package/src/connectors/sublayers.ts +2 -1
- package/src/coordinate.ts +17 -25
- package/src/copy.ts +15 -6
- package/src/cubic.ts +57 -1
- package/src/export-format.ts +11 -1
- package/src/font-style.ts +12 -4
- package/src/generated/index.ts +43 -6
- package/src/generated/kind.ts +16 -2
- package/src/generated/shape-with-text.ts +1 -0
- package/src/generated/spec.ts +243 -0
- package/src/generated/sticky.ts +2 -1
- package/src/geometry.ts +39 -88
- package/src/graph.ts +21 -6
- package/src/hit-test.ts +66 -26
- package/src/images.ts +4 -1
- package/src/instances/content-marks.ts +124 -0
- package/src/instances/deleted.ts +115 -0
- package/src/instances/fields.ts +7 -3
- package/src/instances/index.ts +94 -5
- package/src/instances/lookup.ts +61 -0
- package/src/instances/sync.ts +15 -0
- package/src/layout/flow.ts +5 -3
- package/src/layout/index.ts +1 -0
- package/src/layout/stacking.ts +14 -0
- package/src/matrix.ts +11 -1
- package/src/mesh/geometry.ts +2 -13
- package/src/motion/apply.ts +156 -0
- package/src/motion/edit.ts +148 -0
- package/src/motion/effects.ts +166 -0
- package/src/motion/evaluate.ts +181 -0
- package/src/motion/fields.ts +136 -0
- package/src/motion/index.ts +13 -0
- package/src/motion/keyable.ts +141 -0
- package/src/motion/outline.ts +72 -0
- package/src/motion/presets/index.ts +257 -0
- package/src/motion/presets/settings.ts +221 -0
- package/src/motion/presets/stagger.ts +242 -0
- package/src/motion/schema.ts +66 -0
- package/src/motion/segment.ts +83 -0
- package/src/motion/spec.ts +225 -0
- package/src/motion/timeline.ts +48 -0
- package/src/motion/types.ts +45 -0
- package/src/motion/variables.ts +33 -0
- package/src/node-defaults.ts +131 -49
- package/src/order-keys.ts +16 -2
- package/src/paints/stills.ts +16 -12
- package/src/parse-path.ts +15 -0
- package/src/plugin-data/fields.ts +40 -3
- package/src/polygon.ts +6 -4
- package/src/shaders/model.ts +124 -6
- package/src/shaders/schema.ts +12 -0
- package/src/shape-with-text/document.ts +7 -12
- package/src/shape-with-text/geometry.ts +1 -4
- package/src/slides/index.ts +8 -0
- package/src/slides/motion.ts +35 -1
- package/src/slides/playback.ts +51 -9
- package/src/slots/frames.ts +2 -3
- package/src/specs/index.ts +2 -0
- package/src/specs/model.ts +40 -0
- package/src/specs/schema.ts +43 -0
- package/src/text/lists.ts +20 -7
- package/src/text/paragraphs.ts +10 -3
- package/src/transfer/dependencies.ts +17 -11
- package/src/transfer/library.ts +36 -12
- package/src/transfer/nodes.ts +8 -0
- package/src/types.ts +71 -8
- package/src/undo.ts +10 -1
- package/src/variables/bindings.ts +33 -16
- package/src/variables/easing.ts +16 -17
- package/src/variables/fields.ts +30 -3
- package/src/variables/lookup.ts +24 -1
- package/src/variables/resolution.ts +15 -1
- package/src/variables/units.ts +2 -3
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { clamp } from "es-toolkit/math";
|
|
2
|
+
import { segmentProgress } from "../segment.js";
|
|
3
|
+
import { flagOf, numberOf, presetDirection, presetEasing, textOf } from "./settings.js";
|
|
4
|
+
// src/motion/presets/stagger.ts
|
|
5
|
+
const GROUPINGS = [
|
|
6
|
+
"CHARACTER",
|
|
7
|
+
"CHARACTER_NO_WHITESPACE",
|
|
8
|
+
"WORD",
|
|
9
|
+
"LINE",
|
|
10
|
+
"PARAGRAPH"
|
|
11
|
+
];
|
|
12
|
+
const STAGGER_PIECE_REST = {
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 0,
|
|
15
|
+
rotation: 0,
|
|
16
|
+
scale: 1,
|
|
17
|
+
opacity: 1,
|
|
18
|
+
blur: 0
|
|
19
|
+
};
|
|
20
|
+
function groupingOf(preset, name) {
|
|
21
|
+
const value = textOf(preset, name);
|
|
22
|
+
return GROUPINGS.find((grouping) => grouping === value);
|
|
23
|
+
}
|
|
24
|
+
/** What a text stagger moves as one piece. */
|
|
25
|
+
function staggerGrouping(preset) {
|
|
26
|
+
return groupingOf(preset, "textDelayGrouping") ?? "CHARACTER";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Where a text stagger turns and scales each piece about: a point in the piece's own box, or,
|
|
30
|
+
* with `grouping`, in the box of the word, line or paragraph the piece is part of. The point is
|
|
31
|
+
* a fraction of the box's size.
|
|
32
|
+
*/
|
|
33
|
+
function staggerOrigin(preset) {
|
|
34
|
+
return {
|
|
35
|
+
grouping: groupingOf(preset, "elementTransformOriginMode") ?? null,
|
|
36
|
+
x: numberOf(preset, "elementTransformOriginX") / 100,
|
|
37
|
+
y: numberOf(preset, "elementTransformOriginY") / 100
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Whether a text stagger draws each piece only inside its own box. */
|
|
41
|
+
function staggerClips(preset) {
|
|
42
|
+
return flagOf(preset, "clipContent");
|
|
43
|
+
}
|
|
44
|
+
const isSpace = (text) => /^\s+$/u.test(text);
|
|
45
|
+
const graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
46
|
+
/**
|
|
47
|
+
* The piece each code unit of `text` belongs to when a text stagger moves `grouping` pieces, and
|
|
48
|
+
* how many pieces there are. A space no piece holds is drawn with the piece before it. Lines are
|
|
49
|
+
* known only once the text is laid out, so `LINE` gives every code unit the first piece.
|
|
50
|
+
*/
|
|
51
|
+
function staggerPieces(text, grouping) {
|
|
52
|
+
const pieceOf = new Int32Array(text.length);
|
|
53
|
+
let count = 0;
|
|
54
|
+
let open = false;
|
|
55
|
+
for (const { segment, index } of graphemes.segment(text)) {
|
|
56
|
+
const space = isSpace(segment);
|
|
57
|
+
const paragraphEnd = segment === "\n" || segment === "\r\n";
|
|
58
|
+
let piece;
|
|
59
|
+
if (grouping === "CHARACTER") piece = count++;
|
|
60
|
+
else if (grouping === "PARAGRAPH") {
|
|
61
|
+
if (!open) count++;
|
|
62
|
+
open = !paragraphEnd;
|
|
63
|
+
piece = count - 1;
|
|
64
|
+
} else if (space) {
|
|
65
|
+
if (grouping === "WORD") open = false;
|
|
66
|
+
piece = Math.max(count - 1, 0);
|
|
67
|
+
} else if (grouping === "WORD") {
|
|
68
|
+
if (!open) count++;
|
|
69
|
+
open = true;
|
|
70
|
+
piece = count - 1;
|
|
71
|
+
} else if (grouping === "LINE") {
|
|
72
|
+
count = 1;
|
|
73
|
+
piece = 0;
|
|
74
|
+
} else piece = count++;
|
|
75
|
+
pieceOf.fill(piece, index, index + segment.length);
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
pieceOf,
|
|
79
|
+
count
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/** A number from 0 to 1 that `seed` and `index` always give, for a stable random order. */
|
|
83
|
+
function hashed(seed, index) {
|
|
84
|
+
let hash = 0x811c9dc5 ^ index;
|
|
85
|
+
for (let i = 0; i < seed.length; i++) hash = Math.imul(hash ^ seed.charCodeAt(i), 16777619);
|
|
86
|
+
hash = Math.imul(hash ^ hash >>> 15, 0x85ebca6b);
|
|
87
|
+
return ((hash ^ hash >>> 13) >>> 0) / 4294967296;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* When each of `count` pieces starts, as the step it plays in, and how many steps there are, in
|
|
91
|
+
* the preset's order: left to right, right to left, from the centre out with two pieces sharing
|
|
92
|
+
* each step, or in an order `seed` fixes. Figma's own random order is not known; ours stays the
|
|
93
|
+
* same for a layer from one frame to the next.
|
|
94
|
+
*/
|
|
95
|
+
function staggerSteps(preset, count, seed) {
|
|
96
|
+
const order = textOf(preset, "textDelayOrder");
|
|
97
|
+
const indices = Array.from({ length: count }, (_, index) => index);
|
|
98
|
+
if (order === "RIGHT_LEFT") return {
|
|
99
|
+
stepOf: indices.map((i) => count - 1 - i),
|
|
100
|
+
steps: count
|
|
101
|
+
};
|
|
102
|
+
if (order === "CENTER_OUT") return {
|
|
103
|
+
stepOf: indices.map((i) => Math.floor(Math.abs(i - (count - 1) / 2))),
|
|
104
|
+
steps: Math.floor((count - 1) / 2) + 1
|
|
105
|
+
};
|
|
106
|
+
if (order === "RANDOM") {
|
|
107
|
+
const shuffled = indices.toSorted((a, b) => hashed(seed, a) - hashed(seed, b));
|
|
108
|
+
const stepOf = Array.from({ length: count }, () => 0);
|
|
109
|
+
shuffled.forEach((piece, step) => stepOf[piece] = step);
|
|
110
|
+
return {
|
|
111
|
+
stepOf,
|
|
112
|
+
steps: count
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
stepOf: indices,
|
|
117
|
+
steps: count
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* When the piece playing at `step` of `steps` moves, in seconds into the timeline: the whole text
|
|
122
|
+
* plays over the preset's duration, each step starting the overlap's share of a piece's time
|
|
123
|
+
* before the one before it ends.
|
|
124
|
+
*/
|
|
125
|
+
function staggerPieceSpan(preset, step, steps) {
|
|
126
|
+
const gap = 1 - clamp(numberOf(preset, "presetStaggerOverlap") / 100, 0, 1);
|
|
127
|
+
const each = numberOf(preset, "duration") / (1 + Math.max(steps - 1, 0) * gap);
|
|
128
|
+
const start = preset.offset + step * each * gap;
|
|
129
|
+
return {
|
|
130
|
+
start,
|
|
131
|
+
end: start + each
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* How far a piece playing at `step` of `steps` is through a text stagger at `time`, eased. The
|
|
136
|
+
* whole text plays over the preset's duration, and each step starts the overlap's share of a
|
|
137
|
+
* piece's time before the one before it ends (live 2026-12-01).
|
|
138
|
+
*/
|
|
139
|
+
function pieceProgress(preset, step, steps, time) {
|
|
140
|
+
const { start, end } = staggerPieceSpan(preset, step, steps);
|
|
141
|
+
const each = end - start;
|
|
142
|
+
if (time >= end) return 1;
|
|
143
|
+
if (time <= start) return 0;
|
|
144
|
+
return segmentProgress(presetEasing(preset), time - start, each);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* How a text stagger draws the piece playing at `step` of `steps` at `time`: moved toward its
|
|
148
|
+
* direction, turned, scaled, faded and blurred by the share of each that is switched on, coming
|
|
149
|
+
* to rest as it plays in or leaving rest as it plays out.
|
|
150
|
+
*/
|
|
151
|
+
function staggerPieceAt(preset, step, steps, time) {
|
|
152
|
+
const progress = pieceProgress(preset, step, steps, time);
|
|
153
|
+
const out = textOf(preset, "animationDirection") === "out";
|
|
154
|
+
const away = out ? progress : 1 - progress;
|
|
155
|
+
const way = presetDirection(textOf(preset, "direction"));
|
|
156
|
+
const distance = flagOf(preset, "positionEnabled") ? numberOf(preset, "distance") * away : 0;
|
|
157
|
+
const turn = textOf(preset, "rotationDirection") !== "counterClockwise" === out ? 1 : -1;
|
|
158
|
+
const towards = (name, rest) => flagOf(preset, `${name}Enabled`) ? rest + (numberOf(preset, `${name}Amount`) / 100 - rest) * away : rest;
|
|
159
|
+
return {
|
|
160
|
+
x: way.x * distance,
|
|
161
|
+
y: way.y * distance,
|
|
162
|
+
rotation: flagOf(preset, "rotationEnabled") ? numberOf(preset, "rotationAmount") * turn * away : 0,
|
|
163
|
+
scale: towards("scale", 1),
|
|
164
|
+
opacity: towards("opacity", 1),
|
|
165
|
+
blur: flagOf(preset, "blurEnabled") ? numberOf(preset, "blurAmount") * away : 0
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/** Two motions of one piece drawn together, as two staggers on one text play. */
|
|
169
|
+
function combinedPieceMotion(a, b) {
|
|
170
|
+
return {
|
|
171
|
+
x: a.x + b.x,
|
|
172
|
+
y: a.y + b.y,
|
|
173
|
+
rotation: a.rotation + b.rotation,
|
|
174
|
+
scale: a.scale * b.scale,
|
|
175
|
+
opacity: a.opacity * b.opacity,
|
|
176
|
+
blur: a.blur + b.blur
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/** When a text stagger's last piece comes to rest, in seconds into the timeline. */
|
|
180
|
+
function staggerEnd(preset) {
|
|
181
|
+
return preset.offset + numberOf(preset, "duration");
|
|
182
|
+
}
|
|
183
|
+
export { STAGGER_PIECE_REST, combinedPieceMotion, staggerClips, staggerEnd, staggerGrouping, staggerOrigin, staggerPieceAt, staggerPieceSpan, staggerPieces, staggerSteps };
|
|
184
|
+
|
|
185
|
+
//# sourceMappingURL=stagger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stagger.js","names":[],"sources":["../../../src/motion/presets/stagger.ts"],"sourcesContent":["import { clamp } from 'es-toolkit/math'\n\nimport { segmentProgress } from '../segment'\nimport {\n presetDirection,\n flagOf,\n numberOf,\n presetEasing,\n textOf,\n type MotionPreset\n} from './settings'\n\n/** What a text stagger moves as one piece: a character, a word, a line, or a paragraph. */\nexport type StaggerGrouping =\n | 'CHARACTER'\n | 'CHARACTER_NO_WHITESPACE'\n | 'WORD'\n | 'LINE'\n | 'PARAGRAPH'\n\nconst GROUPINGS: readonly StaggerGrouping[] = [\n 'CHARACTER',\n 'CHARACTER_NO_WHITESPACE',\n 'WORD',\n 'LINE',\n 'PARAGRAPH'\n]\n\n/** How one piece of a staggered text is drawn at a moment, away from where it rests. */\nexport interface StaggerPieceMotion {\n x: number\n y: number\n /** Degrees, clockwise, about the piece's origin. */\n rotation: number\n /** About the piece's origin. */\n scale: number\n opacity: number\n /** A layer blur's radius. */\n blur: number\n}\n\nexport const STAGGER_PIECE_REST: StaggerPieceMotion = {\n x: 0,\n y: 0,\n rotation: 0,\n scale: 1,\n opacity: 1,\n blur: 0\n}\n\nfunction groupingOf(preset: MotionPreset, name: string): StaggerGrouping | undefined {\n const value = textOf(preset, name)\n return GROUPINGS.find((grouping) => grouping === value)\n}\n\n/** What a text stagger moves as one piece. */\nexport function staggerGrouping(preset: MotionPreset): StaggerGrouping {\n return groupingOf(preset, 'textDelayGrouping') ?? 'CHARACTER'\n}\n\n/**\n * Where a text stagger turns and scales each piece about: a point in the piece's own box, or,\n * with `grouping`, in the box of the word, line or paragraph the piece is part of. The point is\n * a fraction of the box's size.\n */\nexport function staggerOrigin(preset: MotionPreset): {\n grouping: StaggerGrouping | null\n x: number\n y: number\n} {\n return {\n grouping: groupingOf(preset, 'elementTransformOriginMode') ?? null,\n x: numberOf(preset, 'elementTransformOriginX') / 100,\n y: numberOf(preset, 'elementTransformOriginY') / 100\n }\n}\n\n/** Whether a text stagger draws each piece only inside its own box. */\nexport function staggerClips(preset: MotionPreset): boolean {\n return flagOf(preset, 'clipContent')\n}\n\nconst isSpace = (text: string) => /^\\s+$/u.test(text)\nconst graphemes = new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n\n/**\n * The piece each code unit of `text` belongs to when a text stagger moves `grouping` pieces, and\n * how many pieces there are. A space no piece holds is drawn with the piece before it. Lines are\n * known only once the text is laid out, so `LINE` gives every code unit the first piece.\n */\nexport function staggerPieces(\n text: string,\n grouping: StaggerGrouping\n): { pieceOf: Int32Array; count: number } {\n const pieceOf = new Int32Array(text.length)\n let count = 0\n let open = false\n for (const { segment, index } of graphemes.segment(text)) {\n const space = isSpace(segment)\n const paragraphEnd = segment === '\\n' || segment === '\\r\\n'\n let piece: number\n if (grouping === 'CHARACTER') piece = count++\n else if (grouping === 'PARAGRAPH') {\n if (!open) count++\n open = !paragraphEnd\n piece = count - 1\n } else if (space) {\n if (grouping === 'WORD') open = false\n piece = Math.max(count - 1, 0)\n } else if (grouping === 'WORD') {\n if (!open) count++\n open = true\n piece = count - 1\n } else if (grouping === 'LINE') {\n count = 1\n piece = 0\n } else piece = count++\n pieceOf.fill(piece, index, index + segment.length)\n }\n return { pieceOf, count }\n}\n\n/** A number from 0 to 1 that `seed` and `index` always give, for a stable random order. */\nfunction hashed(seed: string, index: number): number {\n let hash = 2166136261 ^ index\n for (let i = 0; i < seed.length; i++) hash = Math.imul(hash ^ seed.charCodeAt(i), 16777619)\n hash = Math.imul(hash ^ (hash >>> 15), 2246822507)\n return ((hash ^ (hash >>> 13)) >>> 0) / 4294967296\n}\n\n/**\n * When each of `count` pieces starts, as the step it plays in, and how many steps there are, in\n * the preset's order: left to right, right to left, from the centre out with two pieces sharing\n * each step, or in an order `seed` fixes. Figma's own random order is not known; ours stays the\n * same for a layer from one frame to the next.\n */\nexport function staggerSteps(\n preset: MotionPreset,\n count: number,\n seed: string\n): { stepOf: number[]; steps: number } {\n const order = textOf(preset, 'textDelayOrder')\n const indices = Array.from({ length: count }, (_, index) => index)\n if (order === 'RIGHT_LEFT') return { stepOf: indices.map((i) => count - 1 - i), steps: count }\n if (order === 'CENTER_OUT') {\n const stepOf = indices.map((i) => Math.floor(Math.abs(i - (count - 1) / 2)))\n return { stepOf, steps: Math.floor((count - 1) / 2) + 1 }\n }\n if (order === 'RANDOM') {\n const shuffled = indices.toSorted((a, b) => hashed(seed, a) - hashed(seed, b))\n const stepOf: number[] = Array.from({ length: count }, () => 0)\n shuffled.forEach((piece, step) => (stepOf[piece] = step))\n return { stepOf, steps: count }\n }\n return { stepOf: indices, steps: count }\n}\n\n/**\n * When the piece playing at `step` of `steps` moves, in seconds into the timeline: the whole text\n * plays over the preset's duration, each step starting the overlap's share of a piece's time\n * before the one before it ends.\n */\nexport function staggerPieceSpan(\n preset: MotionPreset,\n step: number,\n steps: number\n): { start: number; end: number } {\n const gap = 1 - clamp(numberOf(preset, 'presetStaggerOverlap') / 100, 0, 1)\n const each = numberOf(preset, 'duration') / (1 + Math.max(steps - 1, 0) * gap)\n const start = preset.offset + step * each * gap\n return { start, end: start + each }\n}\n\n/**\n * How far a piece playing at `step` of `steps` is through a text stagger at `time`, eased. The\n * whole text plays over the preset's duration, and each step starts the overlap's share of a\n * piece's time before the one before it ends (live 2026-12-01).\n */\nfunction pieceProgress(preset: MotionPreset, step: number, steps: number, time: number): number {\n const { start, end } = staggerPieceSpan(preset, step, steps)\n const each = end - start\n // A stagger with no duration has played at its start.\n if (time >= end) return 1\n if (time <= start) return 0\n return segmentProgress(presetEasing(preset), time - start, each)\n}\n\n/**\n * How a text stagger draws the piece playing at `step` of `steps` at `time`: moved toward its\n * direction, turned, scaled, faded and blurred by the share of each that is switched on, coming\n * to rest as it plays in or leaving rest as it plays out.\n */\nexport function staggerPieceAt(\n preset: MotionPreset,\n step: number,\n steps: number,\n time: number\n): StaggerPieceMotion {\n const progress = pieceProgress(preset, step, steps, time)\n const out = textOf(preset, 'animationDirection') === 'out'\n const away = out ? progress : 1 - progress\n const way = presetDirection(textOf(preset, 'direction'))\n const distance = flagOf(preset, 'positionEnabled') ? numberOf(preset, 'distance') * away : 0\n // A clockwise turn comes in from the other way round and goes out the same way round, as the\n // rotation preset's does.\n const clockwise = textOf(preset, 'rotationDirection') !== 'counterClockwise'\n const turn = clockwise === out ? 1 : -1\n const towards = (name: string, rest: number) =>\n flagOf(preset, `${name}Enabled`)\n ? rest + (numberOf(preset, `${name}Amount`) / 100 - rest) * away\n : rest\n return {\n x: way.x * distance,\n y: way.y * distance,\n rotation: flagOf(preset, 'rotationEnabled')\n ? numberOf(preset, 'rotationAmount') * turn * away\n : 0,\n scale: towards('scale', 1),\n opacity: towards('opacity', 1),\n blur: flagOf(preset, 'blurEnabled') ? numberOf(preset, 'blurAmount') * away : 0\n }\n}\n\n/** Two motions of one piece drawn together, as two staggers on one text play. */\nexport function combinedPieceMotion(\n a: StaggerPieceMotion,\n b: StaggerPieceMotion\n): StaggerPieceMotion {\n return {\n x: a.x + b.x,\n y: a.y + b.y,\n rotation: a.rotation + b.rotation,\n scale: a.scale * b.scale,\n opacity: a.opacity * b.opacity,\n blur: a.blur + b.blur\n }\n}\n\n/** When a text stagger's last piece comes to rest, in seconds into the timeline. */\nexport function staggerEnd(preset: MotionPreset): number {\n return preset.offset + numberOf(preset, 'duration')\n}\n"],"mappings":";;;;AAoBA,MAAM,YAAwC;CAC5C;CACA;CACA;CACA;CACA;AACF;AAeA,MAAa,qBAAyC;CACpD,GAAG;CACH,GAAG;CACH,UAAU;CACV,OAAO;CACP,SAAS;CACT,MAAM;AACR;AAEA,SAAS,WAAW,QAAsB,MAA2C;CACnF,MAAM,QAAQ,OAAO,QAAQ,IAAI;CACjC,OAAO,UAAU,MAAM,aAAa,aAAa,KAAK;AACxD;;AAGA,SAAgB,gBAAgB,QAAuC;CACrE,OAAO,WAAW,QAAQ,mBAAmB,KAAK;AACpD;;;;;;AAOA,SAAgB,cAAc,QAI5B;CACA,OAAO;EACL,UAAU,WAAW,QAAQ,4BAA4B,KAAK;EAC9D,GAAG,SAAS,QAAQ,yBAAyB,IAAI;EACjD,GAAG,SAAS,QAAQ,yBAAyB,IAAI;CACnD;AACF;;AAGA,SAAgB,aAAa,QAA+B;CAC1D,OAAO,OAAO,QAAQ,aAAa;AACrC;AAEA,MAAM,WAAW,SAAiB,SAAS,KAAK,IAAI;AACpD,MAAM,YAAY,IAAI,KAAK,UAAU,KAAA,GAAW,EAAE,aAAa,WAAW,CAAC;;;;;;AAO3E,SAAgB,cACd,MACA,UACwC;CACxC,MAAM,UAAU,IAAI,WAAW,KAAK,MAAM;CAC1C,IAAI,QAAQ;CACZ,IAAI,OAAO;CACX,KAAK,MAAM,EAAE,SAAS,WAAW,UAAU,QAAQ,IAAI,GAAG;EACxD,MAAM,QAAQ,QAAQ,OAAO;EAC7B,MAAM,eAAe,YAAY,QAAQ,YAAY;EACrD,IAAI;EACJ,IAAI,aAAa,aAAa,QAAQ;OACjC,IAAI,aAAa,aAAa;GACjC,IAAI,CAAC,MAAM;GACX,OAAO,CAAC;GACR,QAAQ,QAAQ;EAClB,OAAO,IAAI,OAAO;GAChB,IAAI,aAAa,QAAQ,OAAO;GAChC,QAAQ,KAAK,IAAI,QAAQ,GAAG,CAAC;EAC/B,OAAO,IAAI,aAAa,QAAQ;GAC9B,IAAI,CAAC,MAAM;GACX,OAAO;GACP,QAAQ,QAAQ;EAClB,OAAO,IAAI,aAAa,QAAQ;GAC9B,QAAQ;GACR,QAAQ;EACV,OAAO,QAAQ;EACf,QAAQ,KAAK,OAAO,OAAO,QAAQ,QAAQ,MAAM;CACnD;CACA,OAAO;EAAE;EAAS;CAAM;AAC1B;;AAGA,SAAS,OAAO,MAAc,OAAuB;CACnD,IAAI,OAAO,aAAa;CACxB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,OAAO,KAAK,KAAK,OAAO,KAAK,WAAW,CAAC,GAAG,QAAQ;CAC1F,OAAO,KAAK,KAAK,OAAQ,SAAS,IAAK,UAAU;CACjD,SAAS,OAAQ,SAAS,QAAS,KAAK;AAC1C;;;;;;;AAQA,SAAgB,aACd,QACA,OACA,MACqC;CACrC,MAAM,QAAQ,OAAO,QAAQ,gBAAgB;CAC7C,MAAM,UAAU,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,UAAU,KAAK;CACjE,IAAI,UAAU,cAAc,OAAO;EAAE,QAAQ,QAAQ,KAAK,MAAM,QAAQ,IAAI,CAAC;EAAG,OAAO;CAAM;CAC7F,IAAI,UAAU,cAEZ,OAAO;EAAE,QADM,QAAQ,KAAK,MAAM,KAAK,MAAM,KAAK,IAAI,KAAK,QAAQ,KAAK,CAAC,CAAC,CAC5D;EAAG,OAAO,KAAK,OAAO,QAAQ,KAAK,CAAC,IAAI;CAAE;CAE1D,IAAI,UAAU,UAAU;EACtB,MAAM,WAAW,QAAQ,UAAU,GAAG,MAAM,OAAO,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC;EAC7E,MAAM,SAAmB,MAAM,KAAK,EAAE,QAAQ,MAAM,SAAS,CAAC;EAC9D,SAAS,SAAS,OAAO,SAAU,OAAO,SAAS,IAAK;EACxD,OAAO;GAAE;GAAQ,OAAO;EAAM;CAChC;CACA,OAAO;EAAE,QAAQ;EAAS,OAAO;CAAM;AACzC;;;;;;AAOA,SAAgB,iBACd,QACA,MACA,OACgC;CAChC,MAAM,MAAM,IAAI,MAAM,SAAS,QAAQ,sBAAsB,IAAI,KAAK,GAAG,CAAC;CAC1E,MAAM,OAAO,SAAS,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,QAAQ,GAAG,CAAC,IAAI;CAC1E,MAAM,QAAQ,OAAO,SAAS,OAAO,OAAO;CAC5C,OAAO;EAAE;EAAO,KAAK,QAAQ;CAAK;AACpC;;;;;;AAOA,SAAS,cAAc,QAAsB,MAAc,OAAe,MAAsB;CAC9F,MAAM,EAAE,OAAO,QAAQ,iBAAiB,QAAQ,MAAM,KAAK;CAC3D,MAAM,OAAO,MAAM;CAEnB,IAAI,QAAQ,KAAK,OAAO;CACxB,IAAI,QAAQ,OAAO,OAAO;CAC1B,OAAO,gBAAgB,aAAa,MAAM,GAAG,OAAO,OAAO,IAAI;AACjE;;;;;;AAOA,SAAgB,eACd,QACA,MACA,OACA,MACoB;CACpB,MAAM,WAAW,cAAc,QAAQ,MAAM,OAAO,IAAI;CACxD,MAAM,MAAM,OAAO,QAAQ,oBAAoB,MAAM;CACrD,MAAM,OAAO,MAAM,WAAW,IAAI;CAClC,MAAM,MAAM,gBAAgB,OAAO,QAAQ,WAAW,CAAC;CACvD,MAAM,WAAW,OAAO,QAAQ,iBAAiB,IAAI,SAAS,QAAQ,UAAU,IAAI,OAAO;CAI3F,MAAM,OADY,OAAO,QAAQ,mBAAmB,MAAM,uBAC/B,MAAM,IAAI;CACrC,MAAM,WAAW,MAAc,SAC7B,OAAO,QAAQ,GAAG,KAAK,QAAQ,IAC3B,QAAQ,SAAS,QAAQ,GAAG,KAAK,OAAO,IAAI,MAAM,QAAQ,OAC1D;CACN,OAAO;EACL,GAAG,IAAI,IAAI;EACX,GAAG,IAAI,IAAI;EACX,UAAU,OAAO,QAAQ,iBAAiB,IACtC,SAAS,QAAQ,gBAAgB,IAAI,OAAO,OAC5C;EACJ,OAAO,QAAQ,SAAS,CAAC;EACzB,SAAS,QAAQ,WAAW,CAAC;EAC7B,MAAM,OAAO,QAAQ,aAAa,IAAI,SAAS,QAAQ,YAAY,IAAI,OAAO;CAChF;AACF;;AAGA,SAAgB,oBACd,GACA,GACoB;CACpB,OAAO;EACL,GAAG,EAAE,IAAI,EAAE;EACX,GAAG,EAAE,IAAI,EAAE;EACX,UAAU,EAAE,WAAW,EAAE;EACzB,OAAO,EAAE,QAAQ,EAAE;EACnB,SAAS,EAAE,UAAU,EAAE;EACvB,MAAM,EAAE,OAAO,EAAE;CACnB;AACF;;AAGA,SAAgB,WAAW,QAA8B;CACvD,OAAO,OAAO,SAAS,SAAS,QAAQ,UAAU;AACpD"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/** An easing as a transition's is written: CSS, a name, as stored, or an Easing variable. */
|
|
3
|
+
export declare const easingSpecSchema: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
4
|
+
readonly variable: v.StringSchema<undefined>;
|
|
5
|
+
}, undefined>, v.ObjectSchema<{
|
|
6
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
7
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
8
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
9
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
10
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
11
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
12
|
+
}, undefined>, undefined>;
|
|
13
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
14
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
15
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
16
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
17
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
18
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
19
|
+
}, undefined>, undefined>;
|
|
20
|
+
}, undefined>], undefined>, undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* A keyframe as scripts and JSX write it: when, in seconds, the value it reaches (a number, a
|
|
23
|
+
* color such as `#3366FF`, an `{ x, y }` pair, or a switch), and how the stretch arriving at it
|
|
24
|
+
* eases, as a transition's easing is written.
|
|
25
|
+
*/
|
|
26
|
+
export declare const keyframeSpecSchema: v.ObjectSchema<{
|
|
27
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
28
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
29
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
30
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
31
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
32
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
33
|
+
readonly variable: v.StringSchema<undefined>;
|
|
34
|
+
}, undefined>, v.ObjectSchema<{
|
|
35
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
36
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
37
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
38
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
39
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
40
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
41
|
+
}, undefined>, undefined>;
|
|
42
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
43
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
44
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
45
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
46
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
47
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
48
|
+
}, undefined>, undefined>;
|
|
49
|
+
}, undefined>], undefined>, undefined>;
|
|
50
|
+
}, undefined>;
|
|
51
|
+
export type KeyframeSpec = v.InferOutput<typeof keyframeSpecSchema>;
|
|
52
|
+
/**
|
|
53
|
+
* A field's keyframes, or with how they meet the field's own value: `set` replaces it, `offset`
|
|
54
|
+
* adds to it, `scale` multiplies it. Without one, a field takes the operation Figma gives it.
|
|
55
|
+
*/
|
|
56
|
+
export declare const keyframeTrackSpecSchema: v.UnionSchema<[v.ArraySchema<v.ObjectSchema<{
|
|
57
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
58
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
59
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
60
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
61
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
62
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
63
|
+
readonly variable: v.StringSchema<undefined>;
|
|
64
|
+
}, undefined>, v.ObjectSchema<{
|
|
65
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
66
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
67
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
68
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
69
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
70
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
71
|
+
}, undefined>, undefined>;
|
|
72
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
73
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
74
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
75
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
76
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
77
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
78
|
+
}, undefined>, undefined>;
|
|
79
|
+
}, undefined>], undefined>, undefined>;
|
|
80
|
+
}, undefined>, undefined>, v.ObjectSchema<{
|
|
81
|
+
readonly operation: v.PicklistSchema<["set", "offset", "scale"], undefined>;
|
|
82
|
+
readonly keyframes: v.ArraySchema<v.ObjectSchema<{
|
|
83
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
84
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
85
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
86
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
87
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
88
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
89
|
+
readonly variable: v.StringSchema<undefined>;
|
|
90
|
+
}, undefined>, v.ObjectSchema<{
|
|
91
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
92
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
93
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
94
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
95
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
96
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
97
|
+
}, undefined>, undefined>;
|
|
98
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
99
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
100
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
101
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
102
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
103
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
104
|
+
}, undefined>, undefined>;
|
|
105
|
+
}, undefined>], undefined>, undefined>;
|
|
106
|
+
}, undefined>, undefined>;
|
|
107
|
+
}, undefined>], undefined>;
|
|
108
|
+
export type KeyframeTrackSpec = v.InferOutput<typeof keyframeTrackSpecSchema>;
|
|
109
|
+
/**
|
|
110
|
+
* A layer's keyframes by what they animate: a layer field (`opacity`), a motion field by its
|
|
111
|
+
* name (`translationX`, `rotation`, `scale`), or a paint's or effect's field by its address
|
|
112
|
+
* (`fills/0/color`, `effects/0/radius`).
|
|
113
|
+
*/
|
|
114
|
+
export declare const keyframesSpecSchema: v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.ArraySchema<v.ObjectSchema<{
|
|
115
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
116
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
117
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
118
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
119
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
120
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
121
|
+
readonly variable: v.StringSchema<undefined>;
|
|
122
|
+
}, undefined>, v.ObjectSchema<{
|
|
123
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
124
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
125
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
126
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
127
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
128
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
129
|
+
}, undefined>, undefined>;
|
|
130
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
131
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
132
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
133
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
134
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
135
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
136
|
+
}, undefined>, undefined>;
|
|
137
|
+
}, undefined>], undefined>, undefined>;
|
|
138
|
+
}, undefined>, undefined>, v.ObjectSchema<{
|
|
139
|
+
readonly operation: v.PicklistSchema<["set", "offset", "scale"], undefined>;
|
|
140
|
+
readonly keyframes: v.ArraySchema<v.ObjectSchema<{
|
|
141
|
+
readonly time: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
142
|
+
readonly value: v.UnionSchema<[v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.StringSchema<undefined>, v.ObjectSchema<{
|
|
143
|
+
readonly x: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
144
|
+
readonly y: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
145
|
+
}, undefined>, v.BooleanSchema<undefined>], undefined>;
|
|
146
|
+
readonly easing: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ObjectSchema<{
|
|
147
|
+
readonly variable: v.StringSchema<undefined>;
|
|
148
|
+
}, undefined>, v.ObjectSchema<{
|
|
149
|
+
readonly easing: v.PicklistSchema<readonly ["IN_CUBIC", "OUT_CUBIC", "INOUT_CUBIC", "LINEAR", "IN_BACK_CUBIC", "OUT_BACK_CUBIC", "INOUT_BACK_CUBIC", "CUSTOM_CUBIC", "SPRING", "GENTLE_SPRING", "CUSTOM_SPRING", "SPRING_PRESET_ONE", "SPRING_PRESET_TWO", "SPRING_PRESET_THREE", "HOLD", "EASE_IN"], undefined>;
|
|
150
|
+
readonly bezier: v.OptionalSchema<v.ObjectSchema<{
|
|
151
|
+
readonly x1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
152
|
+
readonly y1: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
153
|
+
readonly x2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
154
|
+
readonly y2: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
155
|
+
}, undefined>, undefined>;
|
|
156
|
+
readonly spring: v.OptionalSchema<v.ObjectSchema<{
|
|
157
|
+
readonly stiffness: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
158
|
+
readonly damping: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>;
|
|
159
|
+
readonly mass: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>;
|
|
160
|
+
readonly type: v.OptionalSchema<v.PicklistSchema<["NORMALIZED", "PHYSICAL"], undefined>, undefined>;
|
|
161
|
+
readonly platform: v.OptionalSchema<v.PicklistSchema<["IOS_WEB", "ANDROID"], undefined>, undefined>;
|
|
162
|
+
}, undefined>, undefined>;
|
|
163
|
+
}, undefined>], undefined>, undefined>;
|
|
164
|
+
}, undefined>, undefined>;
|
|
165
|
+
}, undefined>], undefined>, undefined>;
|
|
166
|
+
export type KeyframesSpec = v.InferOutput<typeof keyframesSpecSchema>;
|
|
167
|
+
/** How a frame's timeline plays, each setting left out keeping its default. */
|
|
168
|
+
export declare const timelineSpecSchema: v.ObjectSchema<{
|
|
169
|
+
readonly duration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.GtValueAction<number, 0, undefined>]>, undefined>;
|
|
170
|
+
readonly autoplay: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
171
|
+
readonly loop: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
172
|
+
readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
173
|
+
}, undefined>;
|
|
174
|
+
export type TimelineSpec = v.InferOutput<typeof timelineSpecSchema>;
|
|
175
|
+
/**
|
|
176
|
+
* A preset a layer applies: its kind, when it starts in seconds, and the settings it changes
|
|
177
|
+
* from the preset's defaults, an easing written as a transition's is.
|
|
178
|
+
*/
|
|
179
|
+
export declare const presetSpecSchema: v.ObjectSchema<{
|
|
180
|
+
readonly kind: v.PicklistSchema<readonly ["position", "scale", "rotation", "size", "opacity", "path", "text_stagger"], undefined>;
|
|
181
|
+
readonly offset: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
182
|
+
readonly settings: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
183
|
+
}, undefined>;
|
|
184
|
+
export type PresetSpec = v.InferOutput<typeof presetSpecSchema>;
|
|
185
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/motion/schema.ts"],"mappings":";;qBAOa,kBAAgB,EAAA,eAAA,EAAA,aAAA,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;qBAOhB,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;YAUnB,eAAe,EAAE,mBAAmB;;;;;qBAMnC,yBAAuB,EAAA,aAAA,EAAA,YAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAOxB,oBAAoB,EAAE,mBAAmB;;;;;;qBAOxC,qBAAmB,EAAA,aAAA,EAAA,yBAAA,EAAA,aAAA,EAAA,YAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YACpB,gBAAgB,EAAE,mBAAmB;;qBAGpC,oBAAkB,EAAA;;;;;;YAMnB,eAAe,EAAE,mBAAmB;;;;;qBAMnC,kBAAgB,EAAA;;;;;YAKjB,aAAa,EAAE,mBAAmB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { motionSpecSchema } from "../variables/schema.js";
|
|
3
|
+
import { MOTION_PRESET_KINDS } from "./presets/settings.js";
|
|
4
|
+
// src/motion/schema.ts
|
|
5
|
+
const finiteSchema = v.pipe(v.number(), v.finite());
|
|
6
|
+
/** An easing as a transition's is written: CSS, a name, as stored, or an Easing variable. */
|
|
7
|
+
const easingSpecSchema = motionSpecSchema.entries.easing;
|
|
8
|
+
/**
|
|
9
|
+
* A keyframe as scripts and JSX write it: when, in seconds, the value it reaches (a number, a
|
|
10
|
+
* color such as `#3366FF`, an `{ x, y }` pair, or a switch), and how the stretch arriving at it
|
|
11
|
+
* eases, as a transition's easing is written.
|
|
12
|
+
*/
|
|
13
|
+
const keyframeSpecSchema = v.object({
|
|
14
|
+
time: v.pipe(finiteSchema, v.minValue(0)),
|
|
15
|
+
value: v.union([
|
|
16
|
+
finiteSchema,
|
|
17
|
+
v.string(),
|
|
18
|
+
v.object({
|
|
19
|
+
x: finiteSchema,
|
|
20
|
+
y: finiteSchema
|
|
21
|
+
}),
|
|
22
|
+
v.boolean()
|
|
23
|
+
]),
|
|
24
|
+
easing: easingSpecSchema
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* A field's keyframes, or with how they meet the field's own value: `set` replaces it, `offset`
|
|
28
|
+
* adds to it, `scale` multiplies it. Without one, a field takes the operation Figma gives it.
|
|
29
|
+
*/
|
|
30
|
+
const keyframeTrackSpecSchema = v.union([v.array(keyframeSpecSchema), v.object({
|
|
31
|
+
operation: v.picklist([
|
|
32
|
+
"set",
|
|
33
|
+
"offset",
|
|
34
|
+
"scale"
|
|
35
|
+
]),
|
|
36
|
+
keyframes: v.array(keyframeSpecSchema)
|
|
37
|
+
})]);
|
|
38
|
+
/**
|
|
39
|
+
* A layer's keyframes by what they animate: a layer field (`opacity`), a motion field by its
|
|
40
|
+
* name (`translationX`, `rotation`, `scale`), or a paint's or effect's field by its address
|
|
41
|
+
* (`fills/0/color`, `effects/0/radius`).
|
|
42
|
+
*/
|
|
43
|
+
const keyframesSpecSchema = v.record(v.string(), keyframeTrackSpecSchema);
|
|
44
|
+
/** How a frame's timeline plays, each setting left out keeping its default. */
|
|
45
|
+
const timelineSpecSchema = v.object({
|
|
46
|
+
duration: v.optional(v.pipe(finiteSchema, v.gtValue(0))),
|
|
47
|
+
autoplay: v.optional(v.boolean()),
|
|
48
|
+
loop: v.optional(v.boolean()),
|
|
49
|
+
muted: v.optional(v.boolean())
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* A preset a layer applies: its kind, when it starts in seconds, and the settings it changes
|
|
53
|
+
* from the preset's defaults, an easing written as a transition's is.
|
|
54
|
+
*/
|
|
55
|
+
const presetSpecSchema = v.object({
|
|
56
|
+
kind: v.picklist(MOTION_PRESET_KINDS),
|
|
57
|
+
offset: v.optional(v.pipe(finiteSchema, v.minValue(0))),
|
|
58
|
+
settings: v.optional(v.record(v.string(), v.unknown()))
|
|
59
|
+
});
|
|
60
|
+
export { easingSpecSchema, keyframeSpecSchema, keyframeTrackSpecSchema, keyframesSpecSchema, presetSpecSchema, timelineSpecSchema };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../src/motion/schema.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { motionSpecSchema } from '../variables/schema'\nimport { MOTION_PRESET_KINDS } from './presets'\n\nconst finiteSchema = v.pipe(v.number(), v.finite())\n/** An easing as a transition's is written: CSS, a name, as stored, or an Easing variable. */\nexport const easingSpecSchema = motionSpecSchema.entries.easing\n\n/**\n * A keyframe as scripts and JSX write it: when, in seconds, the value it reaches (a number, a\n * color such as `#3366FF`, an `{ x, y }` pair, or a switch), and how the stretch arriving at it\n * eases, as a transition's easing is written.\n */\nexport const keyframeSpecSchema = v.object({\n time: v.pipe(finiteSchema, v.minValue(0)),\n value: v.union([\n finiteSchema,\n v.string(),\n v.object({ x: finiteSchema, y: finiteSchema }),\n v.boolean()\n ]),\n easing: easingSpecSchema\n})\nexport type KeyframeSpec = v.InferOutput<typeof keyframeSpecSchema>\n\n/**\n * A field's keyframes, or with how they meet the field's own value: `set` replaces it, `offset`\n * adds to it, `scale` multiplies it. Without one, a field takes the operation Figma gives it.\n */\nexport const keyframeTrackSpecSchema = v.union([\n v.array(keyframeSpecSchema),\n v.object({\n operation: v.picklist(['set', 'offset', 'scale']),\n keyframes: v.array(keyframeSpecSchema)\n })\n])\nexport type KeyframeTrackSpec = v.InferOutput<typeof keyframeTrackSpecSchema>\n\n/**\n * A layer's keyframes by what they animate: a layer field (`opacity`), a motion field by its\n * name (`translationX`, `rotation`, `scale`), or a paint's or effect's field by its address\n * (`fills/0/color`, `effects/0/radius`).\n */\nexport const keyframesSpecSchema = v.record(v.string(), keyframeTrackSpecSchema)\nexport type KeyframesSpec = v.InferOutput<typeof keyframesSpecSchema>\n\n/** How a frame's timeline plays, each setting left out keeping its default. */\nexport const timelineSpecSchema = v.object({\n duration: v.optional(v.pipe(finiteSchema, v.gtValue(0))),\n autoplay: v.optional(v.boolean()),\n loop: v.optional(v.boolean()),\n muted: v.optional(v.boolean())\n})\nexport type TimelineSpec = v.InferOutput<typeof timelineSpecSchema>\n\n/**\n * A preset a layer applies: its kind, when it starts in seconds, and the settings it changes\n * from the preset's defaults, an easing written as a transition's is.\n */\nexport const presetSpecSchema = v.object({\n kind: v.picklist(MOTION_PRESET_KINDS),\n offset: v.optional(v.pipe(finiteSchema, v.minValue(0))),\n settings: v.optional(v.record(v.string(), v.unknown()))\n})\nexport type PresetSpec = v.InferOutput<typeof presetSpecSchema>\n"],"mappings":";;;;AAKA,MAAM,eAAe,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;;AAElD,MAAa,mBAAmB,iBAAiB,QAAQ;;;;;;AAOzD,MAAa,qBAAqB,EAAE,OAAO;CACzC,MAAM,EAAE,KAAK,cAAc,EAAE,SAAS,CAAC,CAAC;CACxC,OAAO,EAAE,MAAM;EACb;EACA,EAAE,OAAO;EACT,EAAE,OAAO;GAAE,GAAG;GAAc,GAAG;EAAa,CAAC;EAC7C,EAAE,QAAQ;CACZ,CAAC;CACD,QAAQ;AACV,CAAC;;;;;AAOD,MAAa,0BAA0B,EAAE,MAAM,CAC7C,EAAE,MAAM,kBAAkB,GAC1B,EAAE,OAAO;CACP,WAAW,EAAE,SAAS;EAAC;EAAO;EAAU;CAAO,CAAC;CAChD,WAAW,EAAE,MAAM,kBAAkB;AACvC,CAAC,CACH,CAAC;;;;;;AAQD,MAAa,sBAAsB,EAAE,OAAO,EAAE,OAAO,GAAG,uBAAuB;;AAI/E,MAAa,qBAAqB,EAAE,OAAO;CACzC,UAAU,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;CACvD,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC;CAChC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC5B,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;AAC/B,CAAC;;;;;AAOD,MAAa,mBAAmB,EAAE,OAAO;CACvC,MAAM,EAAE,SAAS,mBAAmB;CACpC,QAAQ,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC;CACtD,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Easing } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* How far along a segment of `duration` seconds the value is `seconds` in, from 0 to 1, by the
|
|
4
|
+
* easing of the keyframe it arrives at; a spring or a back curve may pass 1 on its way.
|
|
5
|
+
*/
|
|
6
|
+
export declare function segmentProgress(easing: Easing, seconds: number, duration: number): number;
|
|
7
|
+
/**
|
|
8
|
+
* A spring between keyframes as an oscillator over the stretch's own progress, from 0 at its
|
|
9
|
+
* start to 1 at its end: its natural frequency and damping ratio in those units. It eases the
|
|
10
|
+
* stretch exactly as `segmentProgress` does, so an export can write it as a function. Null for an
|
|
11
|
+
* easing that is not a spring.
|
|
12
|
+
*/
|
|
13
|
+
export declare function segmentSpring(easing: Easing, duration: number): {
|
|
14
|
+
natural: number;
|
|
15
|
+
ratio: number;
|
|
16
|
+
} | null;
|
|
17
|
+
/**
|
|
18
|
+
* Where a spring stretch is at `progress` through it, from the oscillator `segmentSpring` gives:
|
|
19
|
+
* the same position `segmentProgress` reaches, as a function of progress alone.
|
|
20
|
+
*/
|
|
21
|
+
export declare function springStretchPosition(spring: {
|
|
22
|
+
natural: number;
|
|
23
|
+
ratio: number;
|
|
24
|
+
}, progress: number): number;
|
|
25
|
+
//# sourceMappingURL=segment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment.d.ts","names":[],"sources":["../../src/motion/segment.ts"],"mappings":";;;;;wBAmCgB,gBAAgB,QAAQ,QAAQ,iBAAiB;;;;;;;wBAkBjD,cACd,QAAQ,QACR;EACG;EAAiB;;;;;;wBAeN,sBACd;EAAU;EAAiB;GAC3B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { bezierPosition, easingBezier, easingSpring, settleSpan, springBounce, springPosition } from "../variables/easing.js";
|
|
2
|
+
// src/motion/segment.ts
|
|
3
|
+
/**
|
|
4
|
+
* How far a spring fitted into a segment is `seconds` in: a spring with the easing's bounce,
|
|
5
|
+
* sped up or slowed down so it settles exactly when the segment ends, as Figma fits its springs
|
|
6
|
+
* between keyframes.
|
|
7
|
+
*/
|
|
8
|
+
function segmentSpringPosition(easing, seconds, duration) {
|
|
9
|
+
const spring = easingSpring(easing);
|
|
10
|
+
if (!spring) return seconds / duration;
|
|
11
|
+
const ratio = 1 - springBounce(spring);
|
|
12
|
+
if (!(ratio > 0)) return springPosition({
|
|
13
|
+
...spring,
|
|
14
|
+
damping: Math.max(0, spring.damping)
|
|
15
|
+
}, seconds);
|
|
16
|
+
const frequency = settleSpan(ratio) / duration;
|
|
17
|
+
return springPosition({
|
|
18
|
+
stiffness: frequency * frequency,
|
|
19
|
+
damping: 2 * ratio * frequency,
|
|
20
|
+
mass: 1
|
|
21
|
+
}, seconds);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* How far along a segment of `duration` seconds the value is `seconds` in, from 0 to 1, by the
|
|
25
|
+
* easing of the keyframe it arrives at; a spring or a back curve may pass 1 on its way.
|
|
26
|
+
*/
|
|
27
|
+
function segmentProgress(easing, seconds, duration) {
|
|
28
|
+
if (seconds >= duration) return 1;
|
|
29
|
+
if (seconds <= 0) return 0;
|
|
30
|
+
if (easing.easing === "HOLD") return 0;
|
|
31
|
+
if (easingSpring(easing)) return segmentSpringPosition(easing, seconds, duration);
|
|
32
|
+
const bezier = easingBezier(easing);
|
|
33
|
+
const progress = seconds / duration;
|
|
34
|
+
if (!bezier || bezier.x1 === bezier.y1 && bezier.x2 === bezier.y2) return progress;
|
|
35
|
+
return bezierPosition(bezier, progress);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A spring between keyframes as an oscillator over the stretch's own progress, from 0 at its
|
|
39
|
+
* start to 1 at its end: its natural frequency and damping ratio in those units. It eases the
|
|
40
|
+
* stretch exactly as `segmentProgress` does, so an export can write it as a function. Null for an
|
|
41
|
+
* easing that is not a spring.
|
|
42
|
+
*/
|
|
43
|
+
function segmentSpring(easing, duration) {
|
|
44
|
+
const spring = easingSpring(easing);
|
|
45
|
+
if (!spring) return null;
|
|
46
|
+
const ratio = 1 - springBounce(spring);
|
|
47
|
+
if (ratio > 0) return {
|
|
48
|
+
natural: settleSpan(ratio),
|
|
49
|
+
ratio
|
|
50
|
+
};
|
|
51
|
+
const mass = spring.mass > 0 ? spring.mass : 1;
|
|
52
|
+
return {
|
|
53
|
+
natural: Math.sqrt(Math.max(0, spring.stiffness) / mass) * duration,
|
|
54
|
+
ratio: 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Where a spring stretch is at `progress` through it, from the oscillator `segmentSpring` gives:
|
|
59
|
+
* the same position `segmentProgress` reaches, as a function of progress alone.
|
|
60
|
+
*/
|
|
61
|
+
function springStretchPosition(spring, progress) {
|
|
62
|
+
if (progress >= 1) return 1;
|
|
63
|
+
if (progress <= 0) return 0;
|
|
64
|
+
const { natural, ratio } = spring;
|
|
65
|
+
return springPosition({
|
|
66
|
+
stiffness: natural * natural,
|
|
67
|
+
damping: 2 * ratio * natural,
|
|
68
|
+
mass: 1
|
|
69
|
+
}, progress);
|
|
70
|
+
}
|
|
71
|
+
export { segmentProgress, segmentSpring, springStretchPosition };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segment.js","names":[],"sources":["../../src/motion/segment.ts"],"sourcesContent":["import type { Easing } from '../types'\nimport {\n bezierPosition,\n easingBezier,\n easingSpring,\n springBounce,\n settleSpan,\n springPosition\n} from '../variables/easing'\n\n/**\n * How far a spring fitted into a segment is `seconds` in: a spring with the easing's bounce,\n * sped up or slowed down so it settles exactly when the segment ends, as Figma fits its springs\n * between keyframes.\n */\nfunction segmentSpringPosition(easing: Easing, seconds: number, duration: number): number {\n const spring = easingSpring(easing)\n if (!spring) return seconds / duration\n const ratio = 1 - springBounce(spring)\n // An undamped spring never settles, so there is no span to fit: it swings at its own\n // frequency, without growing, and the segment ends on its value.\n if (!(ratio > 0))\n return springPosition({ ...spring, damping: Math.max(0, spring.damping) }, seconds)\n // Fitted, the spring settles as the segment ends: its span at a frequency of 1, over the time.\n const frequency = settleSpan(ratio) / duration\n return springPosition(\n { stiffness: frequency * frequency, damping: 2 * ratio * frequency, mass: 1 },\n seconds\n )\n}\n\n/**\n * How far along a segment of `duration` seconds the value is `seconds` in, from 0 to 1, by the\n * easing of the keyframe it arrives at; a spring or a back curve may pass 1 on its way.\n */\nexport function segmentProgress(easing: Easing, seconds: number, duration: number): number {\n if (seconds >= duration) return 1\n if (seconds <= 0) return 0\n if (easing.easing === 'HOLD') return 0\n if (easingSpring(easing)) return segmentSpringPosition(easing, seconds, duration)\n const bezier = easingBezier(easing)\n const progress = seconds / duration\n // A curve along the diagonal is linear: exact, without solving it.\n if (!bezier || (bezier.x1 === bezier.y1 && bezier.x2 === bezier.y2)) return progress\n return bezierPosition(bezier, progress)\n}\n\n/**\n * A spring between keyframes as an oscillator over the stretch's own progress, from 0 at its\n * start to 1 at its end: its natural frequency and damping ratio in those units. It eases the\n * stretch exactly as `segmentProgress` does, so an export can write it as a function. Null for an\n * easing that is not a spring.\n */\nexport function segmentSpring(\n easing: Easing,\n duration: number\n): { natural: number; ratio: number } | null {\n const spring = easingSpring(easing)\n if (!spring) return null\n const ratio = 1 - springBounce(spring)\n // Fitted, it settles as the stretch ends: its settling span at a frequency of 1.\n if (ratio > 0) return { natural: settleSpan(ratio), ratio }\n // Undamped, it swings at its own frequency, in the stretch's seconds.\n const mass = spring.mass > 0 ? spring.mass : 1\n return { natural: Math.sqrt(Math.max(0, spring.stiffness) / mass) * duration, ratio: 0 }\n}\n\n/**\n * Where a spring stretch is at `progress` through it, from the oscillator `segmentSpring` gives:\n * the same position `segmentProgress` reaches, as a function of progress alone.\n */\nexport function springStretchPosition(\n spring: { natural: number; ratio: number },\n progress: number\n): number {\n if (progress >= 1) return 1\n if (progress <= 0) return 0\n const { natural, ratio } = spring\n return springPosition(\n { stiffness: natural * natural, damping: 2 * ratio * natural, mass: 1 },\n progress\n )\n}\n"],"mappings":";;;;;;;AAeA,SAAS,sBAAsB,QAAgB,SAAiB,UAA0B;CACxF,MAAM,SAAS,aAAa,MAAM;CAClC,IAAI,CAAC,QAAQ,OAAO,UAAU;CAC9B,MAAM,QAAQ,IAAI,aAAa,MAAM;CAGrC,IAAI,EAAE,QAAQ,IACZ,OAAO,eAAe;EAAE,GAAG;EAAQ,SAAS,KAAK,IAAI,GAAG,OAAO,OAAO;CAAE,GAAG,OAAO;CAEpF,MAAM,YAAY,WAAW,KAAK,IAAI;CACtC,OAAO,eACL;EAAE,WAAW,YAAY;EAAW,SAAS,IAAI,QAAQ;EAAW,MAAM;CAAE,GAC5E,OACF;AACF;;;;;AAMA,SAAgB,gBAAgB,QAAgB,SAAiB,UAA0B;CACzF,IAAI,WAAW,UAAU,OAAO;CAChC,IAAI,WAAW,GAAG,OAAO;CACzB,IAAI,OAAO,WAAW,QAAQ,OAAO;CACrC,IAAI,aAAa,MAAM,GAAG,OAAO,sBAAsB,QAAQ,SAAS,QAAQ;CAChF,MAAM,SAAS,aAAa,MAAM;CAClC,MAAM,WAAW,UAAU;CAE3B,IAAI,CAAC,UAAW,OAAO,OAAO,OAAO,MAAM,OAAO,OAAO,OAAO,IAAK,OAAO;CAC5E,OAAO,eAAe,QAAQ,QAAQ;AACxC;;;;;;;AAQA,SAAgB,cACd,QACA,UAC2C;CAC3C,MAAM,SAAS,aAAa,MAAM;CAClC,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,QAAQ,IAAI,aAAa,MAAM;CAErC,IAAI,QAAQ,GAAG,OAAO;EAAE,SAAS,WAAW,KAAK;EAAG;CAAM;CAE1D,MAAM,OAAO,OAAO,OAAO,IAAI,OAAO,OAAO;CAC7C,OAAO;EAAE,SAAS,KAAK,KAAK,KAAK,IAAI,GAAG,OAAO,SAAS,IAAI,IAAI,IAAI;EAAU,OAAO;CAAE;AACzF;;;;;AAMA,SAAgB,sBACd,QACA,UACQ;CACR,IAAI,YAAY,GAAG,OAAO;CAC1B,IAAI,YAAY,GAAG,OAAO;CAC1B,MAAM,EAAE,SAAS,UAAU;CAC3B,OAAO,eACL;EAAE,WAAW,UAAU;EAAS,SAAS,IAAI,QAAQ;EAAS,MAAM;CAAE,GACtE,QACF;AACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { Easing, SceneNode } from "../types.js";
|
|
3
|
+
import { MotionTarget } from "./fields.js";
|
|
4
|
+
import { MotionPreset } from "./presets/settings.js";
|
|
5
|
+
import { KeyframeSpec, KeyframesSpec, PresetSpec, TimelineSpec } from "./schema.js";
|
|
6
|
+
import { KeyframeOperation, KeyframeTrack, MotionTimeline } from "./types.js";
|
|
7
|
+
/** The operation Figma gives a track on `target`: moves and turns add, scales multiply. */
|
|
8
|
+
export declare function defaultKeyframeOperation(target: MotionTarget): KeyframeOperation;
|
|
9
|
+
/** A layer's keyframe tracks from a spec, by address, each in time order. */
|
|
10
|
+
export declare function keyframeTracksFromSpec(graph: SceneGraph, spec: KeyframesSpec): Record<string, KeyframeTrack>;
|
|
11
|
+
/**
|
|
12
|
+
* An easing as a spec writes it most simply: a preset by its name, a custom curve as CSS, and a
|
|
13
|
+
* spring as stored.
|
|
14
|
+
*/
|
|
15
|
+
export declare function easingToSpec(easing: Easing): NonNullable<KeyframeSpec['easing']>;
|
|
16
|
+
/** A layer's keyframe tracks as a spec writes them: operations only where they differ from Figma's. */
|
|
17
|
+
export declare function keyframeTracksToSpec(graph: SceneGraph, tracks: Record<string, KeyframeTrack>): KeyframesSpec;
|
|
18
|
+
/** A frame's timeline from a spec: what it sets over the defaults. */
|
|
19
|
+
export declare function timelineFromSpec(spec: TimelineSpec): MotionTimeline;
|
|
20
|
+
/** A frame's timeline as a spec writes it: only what differs from the defaults. */
|
|
21
|
+
export declare function timelineToSpec(timeline: SceneNode['timeline']): TimelineSpec | undefined;
|
|
22
|
+
/** A layer's presets from a spec. */
|
|
23
|
+
export declare function presetsFromSpec(graph: SceneGraph, specs: PresetSpec[]): MotionPreset[];
|
|
24
|
+
/** A layer's presets as a spec writes them: settings only where given, easings written simply. */
|
|
25
|
+
export declare function presetsToSpec(presets: MotionPreset[]): PresetSpec[];
|
|
26
|
+
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../src/motion/spec.ts"],"mappings":";;;;;;;wBA0BgB,yBAAyB,QAAQ,eAAe;;wBAgEhD,uBACd,OAAO,YACP,MAAM,gBACL,eAAe;;;;;wBAsBF,aAAa,QAAQ,SAAS,YAAY;;wBAqB1C,qBACd,OAAO,YACP,QAAQ,eAAe,iBACtB;;wBAkBa,iBAAiB,MAAM,eAAe;;wBAKtC,eAAe,UAAU,wBAAwB;;wBAkCjD,gBAAgB,OAAO,YAAY,OAAO,eAAe;;wBAczD,cAAc,SAAS,iBAAiB"}
|