@open-pencil/scene-graph 0.17.0 → 0.18.0-beta.1
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/behaviours/index.d.ts +3 -2
- package/dist/behaviours/index.js +2 -1
- package/dist/behaviours/kinds.d.ts.map +1 -1
- package/dist/behaviours/kinds.js +15 -8
- package/dist/behaviours/kinds.js.map +1 -1
- package/dist/behaviours/model.d.ts +2 -2
- package/dist/behaviours/model.d.ts.map +1 -1
- package/dist/behaviours/model.js.map +1 -1
- package/dist/behaviours/schema.d.ts +136 -1
- package/dist/behaviours/schema.d.ts.map +1 -1
- package/dist/behaviours/schema.js +17 -2
- package/dist/behaviours/schema.js.map +1 -1
- package/dist/behaviours/spec.d.ts.map +1 -1
- package/dist/behaviours/spec.js +4 -0
- package/dist/behaviours/spec.js.map +1 -1
- package/dist/behaviours/transition.d.ts +23 -0
- package/dist/behaviours/transition.d.ts.map +1 -0
- package/dist/behaviours/transition.js +36 -0
- package/dist/behaviours/transition.js.map +1 -0
- package/dist/checkpoint.d.ts.map +1 -1
- package/dist/checkpoint.js +2 -0
- package/dist/checkpoint.js.map +1 -1
- package/dist/color/index.d.ts +12 -9
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.js +15 -25
- package/dist/color/index.js.map +1 -1
- package/dist/color/management.d.ts +51 -23
- package/dist/color/management.d.ts.map +1 -1
- package/dist/color/management.js +154 -149
- package/dist/color/management.js.map +1 -1
- package/dist/color/okhcl.d.ts +28 -10
- package/dist/color/okhcl.d.ts.map +1 -1
- package/dist/color/okhcl.js +56 -40
- package/dist/color/okhcl.js.map +1 -1
- package/dist/color/schema.d.ts +6 -1
- package/dist/color/schema.d.ts.map +1 -1
- package/dist/color/schema.js +10 -1
- package/dist/color/schema.js.map +1 -1
- package/dist/constraints.d.ts.map +1 -1
- package/dist/constraints.js +2 -1
- package/dist/constraints.js.map +1 -1
- package/dist/copy.d.ts +7 -1
- package/dist/copy.d.ts.map +1 -1
- package/dist/copy.js +22 -1
- package/dist/copy.js.map +1 -1
- package/dist/corners.d.ts +3 -1
- package/dist/corners.d.ts.map +1 -1
- package/dist/corners.js +3 -1
- package/dist/corners.js.map +1 -1
- package/dist/css/grid.js +1 -1
- package/dist/css/index.d.ts +2 -1
- package/dist/css/index.js +3 -2
- package/dist/css/motion.d.ts +12 -0
- package/dist/css/motion.d.ts.map +1 -0
- package/dist/css/motion.js +60 -0
- package/dist/css/motion.js.map +1 -0
- package/dist/css/shadows.d.ts +4 -3
- package/dist/css/shadows.d.ts.map +1 -1
- package/dist/css/shadows.js +7 -6
- package/dist/css/shadows.js.map +1 -1
- package/dist/css/values.d.ts +3 -2
- package/dist/css/values.d.ts.map +1 -1
- package/dist/css/values.js +4 -4
- package/dist/css/values.js.map +1 -1
- package/dist/fields/index.d.ts +2 -2
- package/dist/fields/index.js +2 -2
- package/dist/fields/layout.d.ts +3 -1
- package/dist/fields/layout.d.ts.map +1 -1
- package/dist/fields/layout.js +9 -1
- package/dist/fields/layout.js.map +1 -1
- package/dist/figjam/palette.js +1 -1
- package/dist/font-style.d.ts.map +1 -1
- package/dist/font-style.js +7 -3
- package/dist/font-style.js.map +1 -1
- package/dist/generated/index.d.ts +6 -2
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +14 -4
- package/dist/generated/index.js.map +1 -1
- package/dist/geometry.d.ts +6 -1
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +10 -2
- package/dist/geometry.js.map +1 -1
- package/dist/graph.d.ts +29 -4
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +59 -9
- package/dist/graph.js.map +1 -1
- package/dist/group-bounds.d.ts +5 -2
- package/dist/group-bounds.d.ts.map +1 -1
- package/dist/group-bounds.js +38 -8
- package/dist/group-bounds.js.map +1 -1
- package/dist/hit-test.d.ts.map +1 -1
- package/dist/hit-test.js +19 -8
- package/dist/hit-test.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/instances/content-size.js +1 -1
- package/dist/instances/fields.d.ts +2 -2
- package/dist/instances/fields.d.ts.map +1 -1
- package/dist/instances/fields.js +2 -0
- package/dist/instances/fields.js.map +1 -1
- package/dist/instances/index.d.ts.map +1 -1
- package/dist/instances/index.js +50 -11
- package/dist/instances/index.js.map +1 -1
- package/dist/instances/sync.js +67 -7
- package/dist/instances/sync.js.map +1 -1
- package/dist/layout/flow.d.ts +16 -0
- package/dist/layout/flow.d.ts.map +1 -0
- package/dist/layout/flow.js +34 -0
- package/dist/layout/flow.js.map +1 -0
- package/dist/layout/index.d.ts +4 -3
- package/dist/layout/index.js +4 -3
- package/dist/layout/keywords.d.ts.map +1 -1
- package/dist/layout/keywords.js +7 -1
- package/dist/layout/keywords.js.map +1 -1
- package/dist/layout/sizing.d.ts +9 -1
- package/dist/layout/sizing.d.ts.map +1 -1
- package/dist/layout/sizing.js +17 -1
- package/dist/layout/sizing.js.map +1 -1
- package/dist/layout/spacing.d.ts +7 -1
- package/dist/layout/spacing.d.ts.map +1 -1
- package/dist/layout/spacing.js +10 -1
- package/dist/layout/spacing.js.map +1 -1
- package/dist/mesh/geometry.d.ts +83 -0
- package/dist/mesh/geometry.d.ts.map +1 -0
- package/dist/mesh/geometry.js +441 -0
- package/dist/mesh/geometry.js.map +1 -0
- package/dist/mesh/index.d.ts +4 -0
- package/dist/mesh/index.js +4 -0
- package/dist/mesh/model.d.ts +28 -0
- package/dist/mesh/model.d.ts.map +1 -0
- package/dist/mesh/model.js +40 -0
- package/dist/mesh/model.js.map +1 -0
- package/dist/mesh/schema.d.ts +191 -0
- package/dist/mesh/schema.d.ts.map +1 -0
- package/dist/mesh/schema.js +56 -0
- package/dist/mesh/schema.js.map +1 -0
- package/dist/mutation-impact.d.ts +2 -0
- package/dist/mutation-impact.d.ts.map +1 -1
- package/dist/mutation-impact.js +18 -7
- package/dist/mutation-impact.js.map +1 -1
- package/dist/node-defaults.d.ts +3 -1
- package/dist/node-defaults.d.ts.map +1 -1
- package/dist/node-defaults.js +22 -6
- package/dist/node-defaults.js.map +1 -1
- package/dist/paints/index.d.ts +5 -3
- package/dist/paints/index.js +5 -3
- package/dist/paints/pattern.d.ts +5 -1
- package/dist/paints/pattern.d.ts.map +1 -1
- package/dist/paints/pattern.js +33 -1
- package/dist/paints/pattern.js.map +1 -1
- package/dist/paints/shows.d.ts +4 -1
- package/dist/paints/shows.d.ts.map +1 -1
- package/dist/paints/shows.js +8 -1
- package/dist/paints/shows.js.map +1 -1
- package/dist/paints/solid.d.ts +11 -0
- package/dist/paints/solid.d.ts.map +1 -0
- package/dist/paints/solid.js +18 -0
- package/dist/paints/solid.js.map +1 -0
- package/dist/paints/stills.d.ts +74 -0
- package/dist/paints/stills.d.ts.map +1 -0
- package/dist/paints/stills.js +113 -0
- package/dist/paints/stills.js.map +1 -0
- package/dist/plugin-data/field.d.ts.map +1 -1
- package/dist/plugin-data/field.js +2 -0
- package/dist/plugin-data/field.js.map +1 -1
- package/dist/plugin-data/fields.d.ts +67 -0
- package/dist/plugin-data/fields.d.ts.map +1 -1
- package/dist/plugin-data/fields.js +12 -7
- package/dist/plugin-data/fields.js.map +1 -1
- package/dist/resize.d.ts +10 -3
- package/dist/resize.d.ts.map +1 -1
- package/dist/resize.js +34 -3
- package/dist/resize.js.map +1 -1
- package/dist/scaling/index.d.ts +2 -2
- package/dist/scaling/index.js +2 -2
- package/dist/scaling/node.d.ts +2 -1
- package/dist/scaling/node.d.ts.map +1 -1
- package/dist/scaling/node.js +27 -7
- package/dist/scaling/node.js.map +1 -1
- package/dist/shaders/index.d.ts +2 -3
- package/dist/shaders/index.js +2 -3
- package/dist/shaders/model.d.ts +3 -11
- package/dist/shaders/model.d.ts.map +1 -1
- package/dist/shaders/model.js +13 -36
- package/dist/shaders/model.js.map +1 -1
- package/dist/shaders/schema.d.ts +1 -1
- package/dist/shaders/schema.js +1 -1
- package/dist/shaders/schema.js.map +1 -1
- package/dist/shape-with-text/document.js +276 -0
- package/dist/shape-with-text/document.js.map +1 -0
- package/dist/shape-with-text/geometry.d.ts +13 -1
- package/dist/shape-with-text/geometry.d.ts.map +1 -1
- package/dist/shape-with-text/geometry.js +103 -41
- package/dist/shape-with-text/geometry.js.map +1 -1
- package/dist/shape-with-text/index.d.ts +2 -2
- package/dist/shape-with-text/index.js +2 -2
- package/dist/shared-style-index.d.ts +21 -0
- package/dist/shared-style-index.d.ts.map +1 -0
- package/dist/shared-style-index.js +72 -0
- package/dist/shared-style-index.js.map +1 -0
- package/dist/shared-styles.d.ts +3 -3
- package/dist/shared-styles.d.ts.map +1 -1
- package/dist/shared-styles.js +16 -7
- package/dist/shared-styles.js.map +1 -1
- package/dist/slides/drop.d.ts +32 -0
- package/dist/slides/drop.d.ts.map +1 -0
- package/dist/slides/drop.js +81 -0
- package/dist/slides/drop.js.map +1 -0
- package/dist/slides/index.d.ts +56 -0
- package/dist/slides/index.d.ts.map +1 -0
- package/dist/slides/index.js +134 -0
- package/dist/slides/index.js.map +1 -0
- package/dist/slides/motion.d.ts +55 -0
- package/dist/slides/motion.d.ts.map +1 -0
- package/dist/slides/motion.js +142 -0
- package/dist/slides/motion.js.map +1 -0
- package/dist/slides/playback.d.ts +59 -0
- package/dist/slides/playback.d.ts.map +1 -0
- package/dist/slides/playback.js +188 -0
- package/dist/slides/playback.js.map +1 -0
- package/dist/slides/types.d.ts +62 -0
- package/dist/slides/types.d.ts.map +1 -0
- package/dist/slides/types.js +39 -0
- package/dist/slides/types.js.map +1 -0
- package/dist/statuses/workflow.js +1 -1
- package/dist/text/direction.d.ts +6 -3
- package/dist/text/direction.d.ts.map +1 -1
- package/dist/text/direction.js +12 -12
- package/dist/text/direction.js.map +1 -1
- package/dist/text/index.d.ts +2 -1
- package/dist/text/index.js +3 -2
- package/dist/text/name.d.ts +22 -0
- package/dist/text/name.d.ts.map +1 -0
- package/dist/text/name.js +38 -0
- package/dist/text/name.js.map +1 -0
- package/dist/text/references.d.ts.map +1 -1
- package/dist/text/references.js +1 -2
- package/dist/text/references.js.map +1 -1
- package/dist/thumbnail.d.ts +23 -0
- package/dist/thumbnail.d.ts.map +1 -0
- package/dist/thumbnail.js +47 -0
- package/dist/thumbnail.js.map +1 -0
- package/dist/transfer/apply.d.ts.map +1 -1
- package/dist/transfer/apply.js +14 -3
- package/dist/transfer/apply.js.map +1 -1
- package/dist/transfer/copied.d.ts +6 -1
- package/dist/transfer/copied.d.ts.map +1 -1
- package/dist/transfer/copied.js +2 -2
- package/dist/transfer/copied.js.map +1 -1
- package/dist/transfer/dependencies.d.ts +4 -1
- package/dist/transfer/dependencies.d.ts.map +1 -1
- package/dist/transfer/dependencies.js +10 -1
- package/dist/transfer/dependencies.js.map +1 -1
- package/dist/transfer/history.js +2 -0
- package/dist/transfer/history.js.map +1 -1
- package/dist/transfer/identity.js +18 -3
- package/dist/transfer/identity.js.map +1 -1
- package/dist/transfer/index.d.ts +2 -1
- package/dist/transfer/index.js +4 -3
- package/dist/transfer/library.d.ts +45 -0
- package/dist/transfer/library.d.ts.map +1 -0
- package/dist/transfer/library.js +102 -0
- package/dist/transfer/library.js.map +1 -0
- package/dist/transfer/nodes.d.ts.map +1 -1
- package/dist/transfer/nodes.js +9 -0
- package/dist/transfer/nodes.js.map +1 -1
- package/dist/transfer/plan.d.ts +9 -0
- package/dist/transfer/plan.d.ts.map +1 -1
- package/dist/transfer/plan.js +51 -6
- package/dist/transfer/plan.js.map +1 -1
- package/dist/transfer/remove.js +7 -1
- package/dist/transfer/remove.js.map +1 -1
- package/dist/transfer/validation.js +8 -4
- package/dist/transfer/validation.js.map +1 -1
- package/dist/transfer/variables.d.ts.map +1 -1
- package/dist/transfer/variables.js +2 -1
- package/dist/transfer/variables.js.map +1 -1
- package/dist/types.d.ts +90 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +33 -1
- package/dist/types.js.map +1 -1
- package/dist/variables/bindings.d.ts +11 -6
- package/dist/variables/bindings.d.ts.map +1 -1
- package/dist/variables/bindings.js +162 -38
- package/dist/variables/bindings.js.map +1 -1
- package/dist/variables/easing.d.ts +48 -0
- package/dist/variables/easing.d.ts.map +1 -0
- package/dist/variables/easing.js +321 -0
- package/dist/variables/easing.js.map +1 -0
- package/dist/variables/formula/index.d.ts +4 -2
- package/dist/variables/formula/index.d.ts.map +1 -1
- package/dist/variables/formula/index.js +26 -9
- package/dist/variables/formula/index.js.map +1 -1
- package/dist/variables/formula/parse.js +1 -1
- package/dist/variables/formula/schema.js +1 -1
- package/dist/variables/formula/signatures.d.ts +2 -2
- package/dist/variables/formula/signatures.d.ts.map +1 -1
- package/dist/variables/formula/signatures.js.map +1 -1
- package/dist/variables/formula/tree.d.ts +2 -2
- package/dist/variables/formula/tree.d.ts.map +1 -1
- package/dist/variables/formula/tree.js.map +1 -1
- package/dist/variables/index.d.ts +22 -5
- package/dist/variables/index.d.ts.map +1 -1
- package/dist/variables/index.js +67 -17
- package/dist/variables/index.js.map +1 -1
- package/dist/variables/lookup.js +1 -1
- package/dist/variables/lookup.js.map +1 -1
- package/dist/variables/motion.d.ts +46 -0
- package/dist/variables/motion.d.ts.map +1 -0
- package/dist/variables/motion.js +107 -0
- package/dist/variables/motion.js.map +1 -0
- package/dist/variables/paints.d.ts +10 -2
- package/dist/variables/paints.d.ts.map +1 -1
- package/dist/variables/paints.js +24 -10
- package/dist/variables/paints.js.map +1 -1
- package/dist/variables/resolution.d.ts.map +1 -1
- package/dist/variables/resolution.js +10 -9
- package/dist/variables/resolution.js.map +1 -1
- package/dist/variables/schema.d.ts +59 -1
- package/dist/variables/schema.d.ts.map +1 -1
- package/dist/variables/schema.js +36 -1
- package/dist/variables/schema.js.map +1 -1
- package/dist/variables/style-bindings.d.ts +23 -0
- package/dist/variables/style-bindings.d.ts.map +1 -0
- package/dist/variables/style-bindings.js +83 -0
- package/dist/variables/style-bindings.js.map +1 -0
- package/package.json +21 -2
- package/src/behaviours/index.ts +1 -0
- package/src/behaviours/kinds.ts +5 -1
- package/src/behaviours/model.ts +2 -2
- package/src/behaviours/schema.ts +19 -2
- package/src/behaviours/spec.ts +5 -0
- package/src/behaviours/transition.ts +46 -0
- package/src/checkpoint.ts +2 -0
- package/src/color/index.ts +15 -24
- package/src/color/management.ts +144 -168
- package/src/color/okhcl.ts +62 -43
- package/src/color/schema.ts +13 -0
- package/src/constraints.ts +2 -1
- package/src/copy.ts +29 -0
- package/src/corners.ts +3 -0
- package/src/css/index.ts +1 -0
- package/src/css/motion.ts +51 -0
- package/src/css/shadows.ts +7 -6
- package/src/css/values.ts +7 -3
- package/src/fields/layout.ts +9 -0
- package/src/font-style.ts +8 -3
- package/src/generated/index.ts +15 -3
- package/src/geometry.ts +13 -1
- package/src/graph.ts +72 -9
- package/src/group-bounds.ts +54 -13
- package/src/hit-test.ts +13 -8
- package/src/instances/fields.ts +2 -0
- package/src/instances/index.ts +71 -12
- package/src/instances/sync.ts +93 -11
- package/src/layout/flow.ts +34 -0
- package/src/layout/index.ts +1 -0
- package/src/layout/keywords.ts +7 -1
- package/src/layout/sizing.ts +30 -0
- package/src/layout/spacing.ts +12 -0
- package/src/mesh/geometry.ts +433 -0
- package/src/mesh/index.ts +3 -0
- package/src/mesh/model.ts +50 -0
- package/src/mesh/schema.ts +81 -0
- package/src/mutation-impact.ts +23 -7
- package/src/node-defaults.ts +22 -5
- package/src/paints/index.ts +2 -0
- package/src/paints/pattern.ts +55 -0
- package/src/paints/shows.ts +9 -0
- package/src/paints/solid.ts +10 -0
- package/src/paints/stills.ts +182 -0
- package/src/plugin-data/field.ts +3 -0
- package/src/plugin-data/fields.ts +15 -2
- package/src/resize.ts +32 -20
- package/src/scaling/index.ts +1 -1
- package/src/scaling/node.ts +43 -6
- package/src/shaders/index.ts +0 -1
- package/src/shaders/model.ts +19 -49
- package/src/shaders/schema.ts +1 -1
- package/src/shape-with-text/document.ts +175 -0
- package/src/shape-with-text/geometry.ts +99 -27
- package/src/shared-style-index.ts +106 -0
- package/src/shared-styles.ts +21 -14
- package/src/slides/drop.ts +94 -0
- package/src/slides/index.ts +125 -0
- package/src/slides/motion.ts +169 -0
- package/src/slides/playback.ts +200 -0
- package/src/slides/types.ts +94 -0
- package/src/text/direction.ts +13 -23
- package/src/text/index.ts +1 -0
- package/src/text/name.ts +39 -0
- package/src/text/references.ts +3 -3
- package/src/thumbnail.ts +52 -0
- package/src/transfer/apply.ts +16 -3
- package/src/transfer/copied.ts +7 -2
- package/src/transfer/dependencies.ts +10 -1
- package/src/transfer/history.ts +2 -0
- package/src/transfer/identity.ts +34 -2
- package/src/transfer/index.ts +6 -0
- package/src/transfer/library.ts +153 -0
- package/src/transfer/nodes.ts +20 -0
- package/src/transfer/plan.ts +96 -10
- package/src/transfer/remove.ts +6 -2
- package/src/transfer/validation.ts +15 -7
- package/src/transfer/variables.ts +8 -2
- package/src/types.ts +114 -10
- package/src/variables/bindings.ts +260 -36
- package/src/variables/easing.ts +282 -0
- package/src/variables/formula/index.ts +33 -14
- package/src/variables/formula/signatures.ts +6 -2
- package/src/variables/formula/tree.ts +3 -3
- package/src/variables/index.ts +90 -37
- package/src/variables/lookup.ts +1 -1
- package/src/variables/motion.ts +151 -0
- package/src/variables/paints.ts +29 -7
- package/src/variables/resolution.ts +11 -5
- package/src/variables/schema.ts +41 -0
- package/src/variables/style-bindings.ts +137 -0
- package/dist/shaders/still.d.ts +0 -18
- package/dist/shaders/still.d.ts.map +0 -1
- package/dist/shaders/still.js +0 -36
- package/dist/shaders/still.js.map +0 -1
- package/src/shaders/still.ts +0 -41
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { slideDropAt } from "./drop.js";
|
|
2
|
+
import { animatedLayers, animationSlide, animationTarget, defaultLayerAnimation, defaultSlideTransition, mapSlideVariables, resolveSlideTransition, slideBuild, slideVariableIds } from "./motion.js";
|
|
3
|
+
import { LAYER_SLIDE_DISTANCE, MOTION_DIRECTIONS, SLIDE_TRANSITION_KINDS, layerAnimationDirection, layerAnimationStyle, layerAtRest, layerFrame, transitionDirection, transitionFrames, transitionKind, transitionStyle } from "./playback.js";
|
|
4
|
+
import { LAYER_ANIMATION_STYLES, SLIDE_TRANSITION_STYLES } from "./types.js";
|
|
5
|
+
//#region src/slides/index.ts
|
|
6
|
+
/** Figma's slide: 1920 by 1080, with 240 between slides and 600 between the rows of a grid. */
|
|
7
|
+
const DEFAULT_SLIDE_SIZE = {
|
|
8
|
+
width: 1920,
|
|
9
|
+
height: 1080
|
|
10
|
+
};
|
|
11
|
+
/** The sizes a deck offers its slides, by shape; any other size is a custom one. */
|
|
12
|
+
const SLIDE_SIZE_PRESETS = [
|
|
13
|
+
{
|
|
14
|
+
id: "wide",
|
|
15
|
+
width: 1920,
|
|
16
|
+
height: 1080
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "standard",
|
|
20
|
+
width: 1440,
|
|
21
|
+
height: 1080
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "square",
|
|
25
|
+
width: 1080,
|
|
26
|
+
height: 1080
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "portrait",
|
|
30
|
+
width: 1080,
|
|
31
|
+
height: 1920
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
const SLIDE_GAP = 240;
|
|
35
|
+
const ROW_GAP = 600;
|
|
36
|
+
const SLIDES_PER_LINE = 20;
|
|
37
|
+
const WHITE = {
|
|
38
|
+
r: 1,
|
|
39
|
+
g: 1,
|
|
40
|
+
b: 1,
|
|
41
|
+
a: 1
|
|
42
|
+
};
|
|
43
|
+
function defaultSlideSettings() {
|
|
44
|
+
return {
|
|
45
|
+
skipped: false,
|
|
46
|
+
notes: "",
|
|
47
|
+
transition: null
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** What a slide keeps, whether or not it was ever set; null for any other layer. */
|
|
51
|
+
function slideSettings(node) {
|
|
52
|
+
return node.type === "SLIDE" ? node.slide ?? defaultSlideSettings() : null;
|
|
53
|
+
}
|
|
54
|
+
/** The grid that holds a deck's slides on a page, if the page has one. */
|
|
55
|
+
function slideGrid(graph, pageId) {
|
|
56
|
+
return graph.getChildren(pageId).find((node) => node.type === "SLIDE_GRID");
|
|
57
|
+
}
|
|
58
|
+
/** A page's slides by row, in the order a deck presents them. */
|
|
59
|
+
function slideRows(graph, pageId) {
|
|
60
|
+
const grid = slideGrid(graph, pageId);
|
|
61
|
+
if (!grid) return [];
|
|
62
|
+
return graph.getChildren(grid.id).filter((row) => row.type === "SLIDE_ROW").map((row) => graph.getChildren(row.id).filter((node) => node.type === "SLIDE"));
|
|
63
|
+
}
|
|
64
|
+
/** The slide the deck moves on to from `slide`, passing by skipped slides, or undefined at the end. */
|
|
65
|
+
function nextSlide(graph, slide) {
|
|
66
|
+
const page = slide.parentId ? graph.closest(slide.parentId, (node) => node.type === "CANVAS") : void 0;
|
|
67
|
+
if (!page) return void 0;
|
|
68
|
+
const slides = slideRows(graph, page.id).flat();
|
|
69
|
+
const index = slides.findIndex((node) => node.id === slide.id);
|
|
70
|
+
if (index === -1) return void 0;
|
|
71
|
+
return slides.slice(index + 1).find((node) => !slideSettings(node)?.skipped);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Each slide's number, by ID, in the order a deck presents them: skipped slides have none and are
|
|
75
|
+
* not counted, as in Figma.
|
|
76
|
+
*/
|
|
77
|
+
function slideNumbers(graph, pageId) {
|
|
78
|
+
let shown = 0;
|
|
79
|
+
return new Map(slideRows(graph, pageId).flat().map((slide) => [slide.id, slideSettings(slide)?.skipped ? null : ++shown]));
|
|
80
|
+
}
|
|
81
|
+
/** Names a page's slides by their numbers, and a skipped one `-`, as Figma does. */
|
|
82
|
+
function renumberSlides(graph, pageId) {
|
|
83
|
+
for (const [id, number] of slideNumbers(graph, pageId)) {
|
|
84
|
+
const name = number === null ? "-" : String(number);
|
|
85
|
+
if (graph.getNode(id)?.name !== name) graph.updateNode(id, { name });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Adds the grid a deck's slides sit in to a page. */
|
|
89
|
+
function createSlideGrid(graph, pageId) {
|
|
90
|
+
return graph.createNode("SLIDE_GRID", pageId, {
|
|
91
|
+
name: "Presentation",
|
|
92
|
+
layoutMode: "VERTICAL",
|
|
93
|
+
itemSpacing: ROW_GAP,
|
|
94
|
+
paddingTop: SLIDE_GAP,
|
|
95
|
+
paddingLeft: SLIDE_GAP,
|
|
96
|
+
primaryAxisSizing: "HUG",
|
|
97
|
+
counterAxisSizing: "HUG"
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/** Adds a row, which Figma calls a section, to the end of a grid. */
|
|
101
|
+
function createSlideRow(graph, gridId) {
|
|
102
|
+
return graph.createNode("SLIDE_ROW", gridId, {
|
|
103
|
+
name: "Section",
|
|
104
|
+
layoutMode: "HORIZONTAL",
|
|
105
|
+
layoutWrap: "WRAP",
|
|
106
|
+
layoutAlignSelf: "STRETCH",
|
|
107
|
+
itemSpacing: SLIDE_GAP,
|
|
108
|
+
counterAxisSpacing: SLIDE_GAP,
|
|
109
|
+
primaryAxisSizing: "FIXED",
|
|
110
|
+
counterAxisSizing: "HUG",
|
|
111
|
+
maxWidth: SLIDES_PER_LINE * (DEFAULT_SLIDE_SIZE.width + SLIDE_GAP) + SLIDE_GAP
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/** Adds an empty slide to the end of a row, at the size of the slide before it. */
|
|
115
|
+
function createSlide(graph, rowId) {
|
|
116
|
+
const { width, height } = graph.getChildren(rowId).findLast((node) => node.type === "SLIDE") ?? DEFAULT_SLIDE_SIZE;
|
|
117
|
+
return graph.createNode("SLIDE", rowId, {
|
|
118
|
+
name: "Slide",
|
|
119
|
+
width,
|
|
120
|
+
height,
|
|
121
|
+
clipsContent: true,
|
|
122
|
+
fills: [{
|
|
123
|
+
type: "SOLID",
|
|
124
|
+
color: { ...WHITE },
|
|
125
|
+
opacity: 1,
|
|
126
|
+
visible: true
|
|
127
|
+
}],
|
|
128
|
+
slide: defaultSlideSettings()
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { DEFAULT_SLIDE_SIZE, LAYER_ANIMATION_STYLES, LAYER_SLIDE_DISTANCE, MOTION_DIRECTIONS, SLIDE_SIZE_PRESETS, SLIDE_TRANSITION_KINDS, SLIDE_TRANSITION_STYLES, animatedLayers, animationSlide, animationTarget, createSlide, createSlideGrid, createSlideRow, defaultLayerAnimation, defaultSlideSettings, defaultSlideTransition, layerAnimationDirection, layerAnimationStyle, layerAtRest, layerFrame, mapSlideVariables, nextSlide, renumberSlides, resolveSlideTransition, slideBuild, slideDropAt, slideGrid, slideNumbers, slideRows, slideSettings, slideVariableIds, transitionDirection, transitionFrames, transitionKind, transitionStyle };
|
|
133
|
+
|
|
134
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/slides/index.ts"],"sourcesContent":["import type { SceneGraph } from '../graph'\nimport type { SceneNode } from '../types'\nimport type { SlideSettings } from './types'\n\nexport * from './drop'\nexport * from './motion'\nexport * from './playback'\nexport * from './types'\n\n/** Figma's slide: 1920 by 1080, with 240 between slides and 600 between the rows of a grid. */\nexport const DEFAULT_SLIDE_SIZE = { width: 1920, height: 1080 } as const\n\n/** The sizes a deck offers its slides, by shape; any other size is a custom one. */\nexport const SLIDE_SIZE_PRESETS = [\n { id: 'wide', width: 1920, height: 1080 },\n { id: 'standard', width: 1440, height: 1080 },\n { id: 'square', width: 1080, height: 1080 },\n { id: 'portrait', width: 1080, height: 1920 }\n] as const\nexport type SlideSizePreset = (typeof SLIDE_SIZE_PRESETS)[number]\nconst SLIDE_GAP = 240\nconst ROW_GAP = 600\nconst SLIDES_PER_LINE = 20\n\nconst WHITE = { r: 1, g: 1, b: 1, a: 1 } as const\n\nexport function defaultSlideSettings(): SlideSettings {\n return { skipped: false, notes: '', transition: null }\n}\n\n/** What a slide keeps, whether or not it was ever set; null for any other layer. */\nexport function slideSettings(node: Pick<SceneNode, 'type' | 'slide'>): SlideSettings | null {\n return node.type === 'SLIDE' ? (node.slide ?? defaultSlideSettings()) : null\n}\n\n/** The grid that holds a deck's slides on a page, if the page has one. */\nexport function slideGrid(graph: SceneGraph, pageId: string): SceneNode | undefined {\n return graph.getChildren(pageId).find((node) => node.type === 'SLIDE_GRID')\n}\n\n/** A page's slides by row, in the order a deck presents them. */\nexport function slideRows(graph: SceneGraph, pageId: string): SceneNode[][] {\n const grid = slideGrid(graph, pageId)\n if (!grid) return []\n return graph\n .getChildren(grid.id)\n .filter((row) => row.type === 'SLIDE_ROW')\n .map((row) => graph.getChildren(row.id).filter((node) => node.type === 'SLIDE'))\n}\n\n/** The slide the deck moves on to from `slide`, passing by skipped slides, or undefined at the end. */\nexport function nextSlide(graph: SceneGraph, slide: SceneNode): SceneNode | undefined {\n const page = slide.parentId\n ? graph.closest(slide.parentId, (node) => node.type === 'CANVAS')\n : undefined\n if (!page) return undefined\n const slides = slideRows(graph, page.id).flat()\n const index = slides.findIndex((node) => node.id === slide.id)\n if (index === -1) return undefined\n return slides.slice(index + 1).find((node) => !slideSettings(node)?.skipped)\n}\n\n/**\n * Each slide's number, by ID, in the order a deck presents them: skipped slides have none and are\n * not counted, as in Figma.\n */\nexport function slideNumbers(graph: SceneGraph, pageId: string): Map<string, number | null> {\n let shown = 0\n return new Map(\n slideRows(graph, pageId)\n .flat()\n .map((slide) => [slide.id, slideSettings(slide)?.skipped ? null : ++shown])\n )\n}\n\n/** Names a page's slides by their numbers, and a skipped one `-`, as Figma does. */\nexport function renumberSlides(graph: SceneGraph, pageId: string): void {\n for (const [id, number] of slideNumbers(graph, pageId)) {\n const name = number === null ? '-' : String(number)\n if (graph.getNode(id)?.name !== name) graph.updateNode(id, { name })\n }\n}\n\n/** Adds the grid a deck's slides sit in to a page. */\nexport function createSlideGrid(graph: SceneGraph, pageId: string): SceneNode {\n return graph.createNode('SLIDE_GRID', pageId, {\n name: 'Presentation',\n layoutMode: 'VERTICAL',\n itemSpacing: ROW_GAP,\n // Figma pads a grid before its slides only.\n paddingTop: SLIDE_GAP,\n paddingLeft: SLIDE_GAP,\n primaryAxisSizing: 'HUG',\n counterAxisSizing: 'HUG'\n })\n}\n\n/** Adds a row, which Figma calls a section, to the end of a grid. */\nexport function createSlideRow(graph: SceneGraph, gridId: string): SceneNode {\n return graph.createNode('SLIDE_ROW', gridId, {\n name: 'Section',\n layoutMode: 'HORIZONTAL',\n layoutWrap: 'WRAP',\n layoutAlignSelf: 'STRETCH',\n itemSpacing: SLIDE_GAP,\n counterAxisSpacing: SLIDE_GAP,\n primaryAxisSizing: 'FIXED',\n counterAxisSizing: 'HUG',\n maxWidth: SLIDES_PER_LINE * (DEFAULT_SLIDE_SIZE.width + SLIDE_GAP) + SLIDE_GAP\n })\n}\n\n/** Adds an empty slide to the end of a row, at the size of the slide before it. */\nexport function createSlide(graph: SceneGraph, rowId: string): SceneNode {\n const before = graph.getChildren(rowId).findLast((node) => node.type === 'SLIDE')\n const { width, height } = before ?? DEFAULT_SLIDE_SIZE\n return graph.createNode('SLIDE', rowId, {\n name: 'Slide',\n width,\n height,\n clipsContent: true,\n fills: [{ type: 'SOLID', color: { ...WHITE }, opacity: 1, visible: true }],\n slide: defaultSlideSettings()\n })\n}\n"],"mappings":";;;;;;AAUA,MAAa,qBAAqB;CAAE,OAAO;CAAM,QAAQ;AAAK;;AAG9D,MAAa,qBAAqB;CAChC;EAAE,IAAI;EAAQ,OAAO;EAAM,QAAQ;CAAK;CACxC;EAAE,IAAI;EAAY,OAAO;EAAM,QAAQ;CAAK;CAC5C;EAAE,IAAI;EAAU,OAAO;EAAM,QAAQ;CAAK;CAC1C;EAAE,IAAI;EAAY,OAAO;EAAM,QAAQ;CAAK;AAC9C;AAEA,MAAM,YAAY;AAClB,MAAM,UAAU;AAChB,MAAM,kBAAkB;AAExB,MAAM,QAAQ;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE;AAEvC,SAAgB,uBAAsC;CACpD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AmB,QAAsB;CACtE,KAAK,MAAM,CAAC,IAAI,WAAW,aAAa,OAAO,MAAM,GAAG;EACtD,MAAM,OAAO,WAAW,OAAO,MAAM,OAAO,MAAM;EAClD,IAAI,MAAM,QAAQ,EAAE,CAAC,EAAE,SAAS,MAAM,MAAM,WAAW,IAAI,EAAE,KAAK,CAAC;CACrE;AACF;;AAGA,SAAgB,gBAAgB,OAAmB,QAA2B;CAC5E,OAAO,MAAM,WAAW,cAAc,QAAQ;EAC5C,MAAM;EACN,YAAY;EACZ,aAAa;EAEb,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,mBAAmB;CACrB,CAAC;AACH;;AAGA,SAAgB,eAAe,OAAmB,QAA2B;CAC3E,OAAO,MAAM,WAAW,aAAa,QAAQ;EAC3C,MAAM;EACN,YAAY;EACZ,YAAY;EACZ,iBAAiB;EACjB,aAAa;EACb,oBAAoB;EACpB,mBAAmB;EACnB,mBAAmB;EACnB,UAAU,mBAAmB,mBAAmB,QAAQ,aAAa;CACvE,CAAC;AACH;;AAGA,SAAgB,YAAY,OAAmB,OAA0B;CAEvE,MAAM,EAAE,OAAO,WADA,MAAM,YAAY,KAAK,CAAC,CAAC,UAAU,SAAS,KAAK,SAAS,OAC1C,KAAK;CACpC,OAAO,MAAM,WAAW,SAAS,OAAO;EACtC,MAAM;EACN;EACA;EACA,cAAc;EACd,OAAO,CAAC;GAAE,MAAM;GAAS,OAAO,EAAE,GAAG,MAAM;GAAG,SAAS;GAAG,SAAS;EAAK,CAAC;EACzE,OAAO,qBAAqB;CAC9B,CAAC;AACH"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SceneGraph } from "../graph.js";
|
|
2
|
+
import { LayerAnimation, SlideTransition, SlideTransitionStyle } from "./types.js";
|
|
3
|
+
import { SceneNode } from "../types.js";
|
|
4
|
+
import { ResolvedMotion } from "../variables/motion.js";
|
|
5
|
+
//#region src/slides/motion.d.ts
|
|
6
|
+
/** The transition a slide starts with when one is added. */
|
|
7
|
+
declare function defaultSlideTransition(): SlideTransition;
|
|
8
|
+
/** The animation a layer starts with when one is added, as in Figma: it slides in from the left. */
|
|
9
|
+
declare function defaultLayerAnimation(order: number): LayerAnimation;
|
|
10
|
+
/** A slide's transition as it plays, with its variables read for the slide. */
|
|
11
|
+
interface ResolvedSlideTransition extends ResolvedMotion {
|
|
12
|
+
style: SlideTransitionStyle;
|
|
13
|
+
/** Seconds before the deck moves on by itself, or null when it waits for the presenter. */
|
|
14
|
+
delay: number | null;
|
|
15
|
+
}
|
|
16
|
+
declare function resolveSlideTransition(graph: SceneGraph, slide: SceneNode): ResolvedSlideTransition | null;
|
|
17
|
+
/** The variables a layer's slide transition and animation follow. */
|
|
18
|
+
declare function slideVariableIds(node: Pick<SceneNode, 'slide' | 'animation'>): string[];
|
|
19
|
+
/**
|
|
20
|
+
* A layer's slide transition and animation following other variables, as a copy into another
|
|
21
|
+
* document names them; a variable `map` gives nothing for is let go, keeping the value.
|
|
22
|
+
*/
|
|
23
|
+
declare function mapSlideVariables(node: Pick<SceneNode, 'slide' | 'animation'>, map: (variableId: string) => string | undefined): Pick<SceneNode, 'slide' | 'animation'>;
|
|
24
|
+
/** A layer's animation, with the layer it moves. */
|
|
25
|
+
interface AnimatedLayer {
|
|
26
|
+
id: string;
|
|
27
|
+
animation: LayerAnimation;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A step of a slide's build: its layers' animations, one after another. A step waits for the
|
|
31
|
+
* presenter, except a first one made only of `AFTER_PREVIOUS` animations, which plays as the slide
|
|
32
|
+
* appears.
|
|
33
|
+
*/
|
|
34
|
+
interface BuildStep {
|
|
35
|
+
onClick: boolean;
|
|
36
|
+
layers: AnimatedLayer[];
|
|
37
|
+
}
|
|
38
|
+
/** The animated layers of a slide, in the order they play: by `order`, then by layer order. */
|
|
39
|
+
declare function animatedLayers(graph: SceneGraph, slideId: string): AnimatedLayer[];
|
|
40
|
+
/** A slide's build: its animations grouped into the steps a presenter clicks through. */
|
|
41
|
+
declare function slideBuild(graph: SceneGraph, slideId: string): BuildStep[];
|
|
42
|
+
/**
|
|
43
|
+
* The slide a layer animates on, or undefined for a layer that cannot have an animation: one on no
|
|
44
|
+
* slide, a slide itself, or a layer inside an instance, whose component gives it its fields.
|
|
45
|
+
*/
|
|
46
|
+
declare function animationSlide(graph: SceneGraph, layerId: string): SceneNode | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The layer an animation for `layerId` goes on, as Figma's Animate panel picks it: the layer
|
|
49
|
+
* itself, or for a layer inside an instance the outermost instance on the slide, which Figma
|
|
50
|
+
* animates instead. Undefined for a layer on no slide, or a slide.
|
|
51
|
+
*/
|
|
52
|
+
declare function animationTarget(graph: SceneGraph, layerId: string): string | undefined;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { AnimatedLayer, BuildStep, ResolvedSlideTransition, animatedLayers, animationSlide, animationTarget, defaultLayerAnimation, defaultSlideTransition, mapSlideVariables, resolveSlideTransition, slideBuild, slideVariableIds };
|
|
55
|
+
//# sourceMappingURL=motion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.d.ts","names":[],"sources":["../../src/slides/motion.ts"],"mappings":";;;;;;iBAegB,0BAA0B;;iBAa1B,sBAAsB,gBAAgB;;UAYrC,gCAAgC;EAC/C,OAAO;;EAEP;;iBAGc,uBACd,OAAO,YACP,OAAO,YACN;;iBAea,iBAAiB,MAAM,KAAK;;;;;iBAa5B,kBACd,MAAM,KAAK,mCACX,MAAM,4CACL,KAAK;;UAgBS;EACf;EACA,WAAW;;;;;;;UAQI;EACf;EACA,QAAQ;;;iBAIM,eAAe,OAAO,YAAY,kBAAkB;;iBAcpD,WAAW,OAAO,YAAY,kBAAkB;;;;;iBAchD,eAAe,OAAO,YAAY,kBAAkB;;;;;;iBAYpD,gBAAgB,OAAO,YAAY"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { easingPreset } from "../variables/easing.js";
|
|
2
|
+
import { mapMotionVariables, motionVariableIds, resolveMotion, resolveTiming } from "../variables/motion.js";
|
|
3
|
+
import { compact } from "es-toolkit/array";
|
|
4
|
+
//#region src/slides/motion.ts
|
|
5
|
+
/** The transition a slide starts with when one is added. */
|
|
6
|
+
function defaultSlideTransition() {
|
|
7
|
+
return {
|
|
8
|
+
style: "DISSOLVE",
|
|
9
|
+
duration: .3,
|
|
10
|
+
easing: easingPreset("OUT_CUBIC"),
|
|
11
|
+
timing: { type: "ON_CLICK" }
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Figma's curve for layer animations, which its panel does not offer to change. */
|
|
15
|
+
const LAYER_ANIMATION_BEZIER = {
|
|
16
|
+
x1: .17,
|
|
17
|
+
y1: 0,
|
|
18
|
+
x2: .2,
|
|
19
|
+
y2: 1
|
|
20
|
+
};
|
|
21
|
+
/** The animation a layer starts with when one is added, as in Figma: it slides in from the left. */
|
|
22
|
+
function defaultLayerAnimation(order) {
|
|
23
|
+
return {
|
|
24
|
+
style: "SLIDE_FROM_LEFT",
|
|
25
|
+
phase: "IN",
|
|
26
|
+
trigger: "ON_CLICK",
|
|
27
|
+
duration: .6,
|
|
28
|
+
easing: {
|
|
29
|
+
easing: "CUSTOM_CUBIC",
|
|
30
|
+
bezier: { ...LAYER_ANIMATION_BEZIER }
|
|
31
|
+
},
|
|
32
|
+
order
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function resolveSlideTransition(graph, slide) {
|
|
36
|
+
const transition = slide.slide?.transition;
|
|
37
|
+
if (!transition) return null;
|
|
38
|
+
const { timing } = transition;
|
|
39
|
+
return {
|
|
40
|
+
style: transition.style,
|
|
41
|
+
...resolveMotion(graph, transition, slide.id),
|
|
42
|
+
delay: timing.type === "AFTER_DELAY" ? resolveTiming(graph, timing.delayVariableId, slide.id, timing.delay) : null
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** The variables a layer's slide transition and animation follow. */
|
|
46
|
+
function slideVariableIds(node) {
|
|
47
|
+
const transition = node.slide?.transition;
|
|
48
|
+
return [
|
|
49
|
+
...transition ? motionVariableIds(transition) : [],
|
|
50
|
+
...compact([transition?.timing.type === "AFTER_DELAY" && transition.timing.delayVariableId]),
|
|
51
|
+
...node.animation ? motionVariableIds(node.animation) : []
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A layer's slide transition and animation following other variables, as a copy into another
|
|
56
|
+
* document names them; a variable `map` gives nothing for is let go, keeping the value.
|
|
57
|
+
*/
|
|
58
|
+
function mapSlideVariables(node, map) {
|
|
59
|
+
const transition = node.slide?.transition;
|
|
60
|
+
let slide = node.slide && structuredClone(node.slide);
|
|
61
|
+
if (slide && transition) {
|
|
62
|
+
const mapped = mapMotionVariables(transition, map);
|
|
63
|
+
if (transition.timing.type === "AFTER_DELAY") {
|
|
64
|
+
const { delayVariableId, ...timing } = transition.timing;
|
|
65
|
+
const delay = delayVariableId === void 0 ? void 0 : map(delayVariableId);
|
|
66
|
+
mapped.timing = delay === void 0 ? timing : {
|
|
67
|
+
...timing,
|
|
68
|
+
delayVariableId: delay
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
slide = {
|
|
72
|
+
...slide,
|
|
73
|
+
transition: mapped
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
slide,
|
|
78
|
+
animation: node.animation && mapMotionVariables(node.animation, map)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** The animated layers of a slide, in the order they play: by `order`, then by layer order. */
|
|
82
|
+
function animatedLayers(graph, slideId) {
|
|
83
|
+
const layers = [];
|
|
84
|
+
const visit = (id) => {
|
|
85
|
+
for (const child of graph.getChildren(id)) {
|
|
86
|
+
if (child.animation) layers.push({
|
|
87
|
+
id: child.id,
|
|
88
|
+
animation: child.animation
|
|
89
|
+
});
|
|
90
|
+
visit(child.id);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
visit(slideId);
|
|
94
|
+
return layers.sort((a, b) => a.animation.order - b.animation.order);
|
|
95
|
+
}
|
|
96
|
+
/** A slide's build: its animations grouped into the steps a presenter clicks through. */
|
|
97
|
+
function slideBuild(graph, slideId) {
|
|
98
|
+
const steps = [];
|
|
99
|
+
for (const layer of animatedLayers(graph, slideId)) {
|
|
100
|
+
const last = steps.at(-1);
|
|
101
|
+
if (layer.animation.trigger === "AFTER_PREVIOUS" && last) last.layers.push(layer);
|
|
102
|
+
else steps.push({
|
|
103
|
+
onClick: layer.animation.trigger === "ON_CLICK",
|
|
104
|
+
layers: [layer]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return steps;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The slide a layer animates on, or undefined for a layer that cannot have an animation: one on no
|
|
111
|
+
* slide, a slide itself, or a layer inside an instance, whose component gives it its fields.
|
|
112
|
+
*/
|
|
113
|
+
function animationSlide(graph, layerId) {
|
|
114
|
+
const node = graph.getNode(layerId);
|
|
115
|
+
if (!node?.parentId || node.type === "SLIDE") return void 0;
|
|
116
|
+
if (graph.closest(node.parentId, (item) => item.type === "INSTANCE")) return void 0;
|
|
117
|
+
return graph.closest(node.parentId, (item) => item.type === "SLIDE") ?? void 0;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The layer an animation for `layerId` goes on, as Figma's Animate panel picks it: the layer
|
|
121
|
+
* itself, or for a layer inside an instance the outermost instance on the slide, which Figma
|
|
122
|
+
* animates instead. Undefined for a layer on no slide, or a slide.
|
|
123
|
+
*/
|
|
124
|
+
function animationTarget(graph, layerId) {
|
|
125
|
+
const node = graph.getNode(layerId);
|
|
126
|
+
if (!node || node.type === "SLIDE") return void 0;
|
|
127
|
+
let target = layerId;
|
|
128
|
+
let id = node.parentId;
|
|
129
|
+
const seen = /* @__PURE__ */ new Set();
|
|
130
|
+
while (id && !seen.has(id)) {
|
|
131
|
+
seen.add(id);
|
|
132
|
+
const parent = graph.getNode(id);
|
|
133
|
+
if (!parent) return void 0;
|
|
134
|
+
if (parent.type === "SLIDE") return target;
|
|
135
|
+
if (parent.type === "INSTANCE") target = parent.id;
|
|
136
|
+
id = parent.parentId;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
export { animatedLayers, animationSlide, animationTarget, defaultLayerAnimation, defaultSlideTransition, mapSlideVariables, resolveSlideTransition, slideBuild, slideVariableIds };
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=motion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.js","names":[],"sources":["../../src/slides/motion.ts"],"sourcesContent":["import { compact } from 'es-toolkit/array'\n\nimport type { SceneGraph } from '../graph'\nimport type { SceneNode } from '../types'\nimport { easingPreset } from '../variables/easing'\nimport {\n mapMotionVariables,\n motionVariableIds,\n resolveMotion,\n resolveTiming,\n type ResolvedMotion\n} from '../variables/motion'\nimport type { LayerAnimation, SlideTransition, SlideTransitionStyle } from './types'\n\n/** The transition a slide starts with when one is added. */\nexport function defaultSlideTransition(): SlideTransition {\n return {\n style: 'DISSOLVE',\n duration: 0.3,\n easing: easingPreset('OUT_CUBIC'),\n timing: { type: 'ON_CLICK' }\n }\n}\n\n/** Figma's curve for layer animations, which its panel does not offer to change. */\nconst LAYER_ANIMATION_BEZIER = { x1: 0.17, y1: 0, x2: 0.2, y2: 1 }\n\n/** The animation a layer starts with when one is added, as in Figma: it slides in from the left. */\nexport function defaultLayerAnimation(order: number): LayerAnimation {\n return {\n style: 'SLIDE_FROM_LEFT',\n phase: 'IN',\n trigger: 'ON_CLICK',\n duration: 0.6,\n easing: { easing: 'CUSTOM_CUBIC', bezier: { ...LAYER_ANIMATION_BEZIER } },\n order\n }\n}\n\n/** A slide's transition as it plays, with its variables read for the slide. */\nexport interface ResolvedSlideTransition extends ResolvedMotion {\n style: SlideTransitionStyle\n /** Seconds before the deck moves on by itself, or null when it waits for the presenter. */\n delay: number | null\n}\n\nexport function resolveSlideTransition(\n graph: SceneGraph,\n slide: SceneNode\n): ResolvedSlideTransition | null {\n const transition = slide.slide?.transition\n if (!transition) return null\n const { timing } = transition\n return {\n style: transition.style,\n ...resolveMotion(graph, transition, slide.id),\n delay:\n timing.type === 'AFTER_DELAY'\n ? resolveTiming(graph, timing.delayVariableId, slide.id, timing.delay)\n : null\n }\n}\n\n/** The variables a layer's slide transition and animation follow. */\nexport function slideVariableIds(node: Pick<SceneNode, 'slide' | 'animation'>): string[] {\n const transition = node.slide?.transition\n return [\n ...(transition ? motionVariableIds(transition) : []),\n ...compact([transition?.timing.type === 'AFTER_DELAY' && transition.timing.delayVariableId]),\n ...(node.animation ? motionVariableIds(node.animation) : [])\n ]\n}\n\n/**\n * A layer's slide transition and animation following other variables, as a copy into another\n * document names them; a variable `map` gives nothing for is let go, keeping the value.\n */\nexport function mapSlideVariables(\n node: Pick<SceneNode, 'slide' | 'animation'>,\n map: (variableId: string) => string | undefined\n): Pick<SceneNode, 'slide' | 'animation'> {\n const transition = node.slide?.transition\n let slide = node.slide && structuredClone(node.slide)\n if (slide && transition) {\n const mapped = mapMotionVariables(transition, map)\n if (transition.timing.type === 'AFTER_DELAY') {\n const { delayVariableId, ...timing } = transition.timing\n const delay = delayVariableId === undefined ? undefined : map(delayVariableId)\n mapped.timing = delay === undefined ? timing : { ...timing, delayVariableId: delay }\n }\n slide = { ...slide, transition: mapped }\n }\n return { slide, animation: node.animation && mapMotionVariables(node.animation, map) }\n}\n\n/** A layer's animation, with the layer it moves. */\nexport interface AnimatedLayer {\n id: string\n animation: LayerAnimation\n}\n\n/**\n * A step of a slide's build: its layers' animations, one after another. A step waits for the\n * presenter, except a first one made only of `AFTER_PREVIOUS` animations, which plays as the slide\n * appears.\n */\nexport interface BuildStep {\n onClick: boolean\n layers: AnimatedLayer[]\n}\n\n/** The animated layers of a slide, in the order they play: by `order`, then by layer order. */\nexport function animatedLayers(graph: SceneGraph, slideId: string): AnimatedLayer[] {\n const layers: AnimatedLayer[] = []\n const visit = (id: string) => {\n for (const child of graph.getChildren(id)) {\n if (child.animation) layers.push({ id: child.id, animation: child.animation })\n visit(child.id)\n }\n }\n visit(slideId)\n // Array sort is stable, so equal orders keep layer order.\n return layers.sort((a, b) => a.animation.order - b.animation.order)\n}\n\n/** A slide's build: its animations grouped into the steps a presenter clicks through. */\nexport function slideBuild(graph: SceneGraph, slideId: string): BuildStep[] {\n const steps: BuildStep[] = []\n for (const layer of animatedLayers(graph, slideId)) {\n const last = steps.at(-1)\n if (layer.animation.trigger === 'AFTER_PREVIOUS' && last) last.layers.push(layer)\n else steps.push({ onClick: layer.animation.trigger === 'ON_CLICK', layers: [layer] })\n }\n return steps\n}\n\n/**\n * The slide a layer animates on, or undefined for a layer that cannot have an animation: one on no\n * slide, a slide itself, or a layer inside an instance, whose component gives it its fields.\n */\nexport function animationSlide(graph: SceneGraph, layerId: string): SceneNode | undefined {\n const node = graph.getNode(layerId)\n if (!node?.parentId || node.type === 'SLIDE') return undefined\n if (graph.closest(node.parentId, (item) => item.type === 'INSTANCE')) return undefined\n return graph.closest(node.parentId, (item) => item.type === 'SLIDE') ?? undefined\n}\n\n/**\n * The layer an animation for `layerId` goes on, as Figma's Animate panel picks it: the layer\n * itself, or for a layer inside an instance the outermost instance on the slide, which Figma\n * animates instead. Undefined for a layer on no slide, or a slide.\n */\nexport function animationTarget(graph: SceneGraph, layerId: string): string | undefined {\n const node = graph.getNode(layerId)\n if (!node || node.type === 'SLIDE') return undefined\n let target = layerId\n let id = node.parentId\n // A parent cycle in bad data ends the walk.\n const seen = new Set<string>()\n while (id && !seen.has(id)) {\n seen.add(id)\n const parent = graph.getNode(id)\n if (!parent) return undefined\n if (parent.type === 'SLIDE') return target\n if (parent.type === 'INSTANCE') target = parent.id\n id = parent.parentId\n }\n return undefined\n}\n"],"mappings":";;;;;AAeA,SAAgB,yBAA0C;CACxD,OAAO;EACL,OAAO;EACP,UAAU;EACV,QAAQ,aAAa,WAAW;EAChC,QAAQ,EAAE,MAAM,W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AS;CACb,IAAI,KAAK,KAAK;CAEd,MAAM,uBAAO,IAAI,IAAY;CAC7B,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,GAAG;EAC1B,KAAK,IAAI,EAAE;EACX,MAAM,SAAS,MAAM,QAAQ,EAAE;EAC/B,IAAI,CAAC,QAAQ,OAAO,KAAA;EACpB,IAAI,OAAO,SAAS,SAAS,OAAO;EACpC,IAAI,OAAO,SAAS,YAAY,SAAS,OAAO;EAChD,KAAK,OAAO;CACd;AAEF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LayerAnimation, SlideTransitionStyle } from "./types.js";
|
|
2
|
+
//#region src/slides/playback.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* How a slide is drawn at a moment of a transition: moved by fractions of its own width and
|
|
5
|
+
* height, faded, and darkened towards black.
|
|
6
|
+
*/
|
|
7
|
+
interface SlideFrame {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
opacity: number;
|
|
11
|
+
/** How dark: 0 is the slide as it is, 1 black. */
|
|
12
|
+
dim: number;
|
|
13
|
+
}
|
|
14
|
+
/** The two slides of a transition, the one drawn first below the other. */
|
|
15
|
+
interface TransitionFrames {
|
|
16
|
+
from: SlideFrame;
|
|
17
|
+
to: SlideFrame;
|
|
18
|
+
/** Which slide is drawn on top. */
|
|
19
|
+
above: 'from' | 'to';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Where the slides of a transition are when its easing is at `position`: 0 at the start, 1 at the
|
|
23
|
+
* end, past 1 while a spring overshoots. Smart animate plays as Dissolve for now.
|
|
24
|
+
*/
|
|
25
|
+
declare function transitionFrames(style: SlideTransitionStyle, position: number): TransitionFrames;
|
|
26
|
+
/** How far, in slide pixels, a layer slides on or off, whatever its size, as in Figma. */
|
|
27
|
+
declare const LAYER_SLIDE_DISTANCE = 300;
|
|
28
|
+
/** Where a layer animating onto or off its slide is drawn, relative to where it is. */
|
|
29
|
+
interface LayerFrame {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
opacity: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Where an animating layer is when its easing is at `position`. A layer coming in fades in as it
|
|
36
|
+
* slides the last stretch to its place; one going out keeps moving the same way as it fades.
|
|
37
|
+
*/
|
|
38
|
+
declare function layerFrame(animation: Pick<LayerAnimation, 'style' | 'phase'>, position: number): LayerFrame;
|
|
39
|
+
/** Where a layer is drawn before its step has played, or after. */
|
|
40
|
+
declare function layerAtRest(animation: Pick<LayerAnimation, 'phase'>, played: boolean): LayerFrame;
|
|
41
|
+
/** The transitions Figma's panel offers, each but the first three in four directions. */
|
|
42
|
+
declare const SLIDE_TRANSITION_KINDS: readonly ["NONE", "SMART_ANIMATE", "DISSOLVE", "PUSH", "SLIDE_IN", "SLIDE_OUT", "MOVE_IN", "MOVE_OUT"];
|
|
43
|
+
type SlideTransitionKind = (typeof SLIDE_TRANSITION_KINDS)[number];
|
|
44
|
+
/** Which way a transition or a layer moves, as Figma's arrows show it. */
|
|
45
|
+
declare const MOTION_DIRECTIONS: readonly ["LEFT", "RIGHT", "DOWN", "UP"];
|
|
46
|
+
type MotionDirection = (typeof MOTION_DIRECTIONS)[number];
|
|
47
|
+
/** A style's kind, as Figma's panel lists it. */
|
|
48
|
+
declare function transitionKind(style: SlideTransitionStyle): SlideTransitionKind;
|
|
49
|
+
/** Which way a style moves its slides, or null for one that does not move them. */
|
|
50
|
+
declare function transitionDirection(style: SlideTransitionStyle): MotionDirection | null;
|
|
51
|
+
/** The style of a kind moving `direction`; a kind that does not move ignores it. */
|
|
52
|
+
declare function transitionStyle(kind: SlideTransitionKind, direction: MotionDirection): SlideTransitionStyle;
|
|
53
|
+
/** Which way a layer animation moves its layer, or null for a fade. */
|
|
54
|
+
declare function layerAnimationDirection(style: LayerAnimation['style']): MotionDirection | null;
|
|
55
|
+
/** The layer animation that slides its layer `direction`, or fades it with null. */
|
|
56
|
+
declare function layerAnimationStyle(direction: MotionDirection | null): LayerAnimation['style'];
|
|
57
|
+
//#endregion
|
|
58
|
+
export { LAYER_SLIDE_DISTANCE, LayerFrame, MOTION_DIRECTIONS, MotionDirection, SLIDE_TRANSITION_KINDS, SlideFrame, SlideTransitionKind, TransitionFrames, layerAnimationDirection, layerAnimationStyle, layerAtRest, layerFrame, transitionDirection, transitionFrames, transitionKind, transitionStyle };
|
|
59
|
+
//# sourceMappingURL=playback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback.d.ts","names":[],"sources":["../../src/slides/playback.ts"],"mappings":";;;;;;UAOiB;EACf;EACA;EACA;;EAEA;;;UAIe;EACf,MAAM;EACN,IAAI;;EAEJ;;;;;;iBA4Cc,iBAAiB,OAAO,sBAAsB,mBAAmB;;cA0BpE;;UAGI;EACf;EACA;EACA;;;;;;iBAcc,WACd,WAAW,KAAK,oCAChB,mBACC;;iBASa,YAAY,WAAW,KAAK,0BAA0B,kBAAkB;;cAM3E;KAUD,8BAA8B;;cAG7B;KACD,0BAA0B;;iBA6BtB,eAAe,OAAO,uBAAuB;;iBAO7C,oBAAoB,OAAO,uBAAuB;;iBAKlD,gBACd,MAAM,qBACN,WAAW,kBACV;;iBAMa,wBAAwB,OAAO,0BAA0B;;iBAKzD,oBAAoB,WAAW,yBAAyB"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
//#region src/slides/playback.ts
|
|
2
|
+
/** How far the slide underneath moves in Slide in and Slide out, as Figma moves it. */
|
|
3
|
+
const PARALLAX = .25;
|
|
4
|
+
/** How dark the slide underneath gets in Slide in and Slide out. */
|
|
5
|
+
const UNDERNEATH_DIM = .5;
|
|
6
|
+
const RIGHTWARDS = [1, 0];
|
|
7
|
+
const LEFTWARDS = [-1, 0];
|
|
8
|
+
const DOWNWARDS = [0, 1];
|
|
9
|
+
const UPWARDS = [0, -1];
|
|
10
|
+
/**
|
|
11
|
+
* The way a style moves its slides. A `FROM` side is the side the slide comes from. Figma's `OUT_TO`
|
|
12
|
+
* names are mirrored: its panel shows SLIDE_OUT_TO_LEFT as → and plays it moving right.
|
|
13
|
+
*/
|
|
14
|
+
function directionOf(style) {
|
|
15
|
+
if (style.endsWith("FROM_LEFT") || style.endsWith("OUT_TO_LEFT")) return RIGHTWARDS;
|
|
16
|
+
if (style.endsWith("FROM_RIGHT") || style.endsWith("OUT_TO_RIGHT")) return LEFTWARDS;
|
|
17
|
+
if (style.endsWith("FROM_TOP") || style.endsWith("OUT_TO_TOP")) return DOWNWARDS;
|
|
18
|
+
return UPWARDS;
|
|
19
|
+
}
|
|
20
|
+
function clamp01(value) {
|
|
21
|
+
return Math.min(1, Math.max(0, value));
|
|
22
|
+
}
|
|
23
|
+
/** A direction scaled by `amount`, with no negative zero where the direction has no part. */
|
|
24
|
+
function along(direction, amount) {
|
|
25
|
+
return {
|
|
26
|
+
x: direction[0] * amount || 0,
|
|
27
|
+
y: direction[1] * amount || 0
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function frame(direction, offset, dim = 0, opacity = 1) {
|
|
31
|
+
return {
|
|
32
|
+
...along(direction, offset),
|
|
33
|
+
opacity,
|
|
34
|
+
dim: clamp01(dim)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const STILL = {
|
|
38
|
+
x: 0,
|
|
39
|
+
y: 0,
|
|
40
|
+
opacity: 1,
|
|
41
|
+
dim: 0
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Where the slides of a transition are when its easing is at `position`: 0 at the start, 1 at the
|
|
45
|
+
* end, past 1 while a spring overshoots. Smart animate plays as Dissolve for now.
|
|
46
|
+
*/
|
|
47
|
+
function transitionFrames(style, position) {
|
|
48
|
+
const p = position;
|
|
49
|
+
if (style === "NONE") return {
|
|
50
|
+
from: STILL,
|
|
51
|
+
to: STILL,
|
|
52
|
+
above: "to"
|
|
53
|
+
};
|
|
54
|
+
if (style === "DISSOLVE" || style === "SMART_ANIMATE") return {
|
|
55
|
+
from: STILL,
|
|
56
|
+
to: {
|
|
57
|
+
...STILL,
|
|
58
|
+
opacity: clamp01(p)
|
|
59
|
+
},
|
|
60
|
+
above: "to"
|
|
61
|
+
};
|
|
62
|
+
const direction = directionOf(style);
|
|
63
|
+
if (style.startsWith("PUSH_")) return {
|
|
64
|
+
from: frame(direction, p),
|
|
65
|
+
to: frame(direction, p - 1),
|
|
66
|
+
above: "to"
|
|
67
|
+
};
|
|
68
|
+
if (style.startsWith("MOVE_FROM_")) return {
|
|
69
|
+
from: STILL,
|
|
70
|
+
to: frame(direction, p - 1),
|
|
71
|
+
above: "to"
|
|
72
|
+
};
|
|
73
|
+
if (style.startsWith("MOVE_OUT_")) return {
|
|
74
|
+
from: frame(direction, p),
|
|
75
|
+
to: STILL,
|
|
76
|
+
above: "from"
|
|
77
|
+
};
|
|
78
|
+
if (style.startsWith("SLIDE_FROM_")) return {
|
|
79
|
+
from: frame(direction, PARALLAX * p, UNDERNEATH_DIM * p),
|
|
80
|
+
to: frame(direction, p - 1),
|
|
81
|
+
above: "to"
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
from: frame(direction, p),
|
|
85
|
+
to: frame(direction, PARALLAX * (p - 1), UNDERNEATH_DIM * (1 - p)),
|
|
86
|
+
above: "from"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** How far, in slide pixels, a layer slides on or off, whatever its size, as in Figma. */
|
|
90
|
+
const LAYER_SLIDE_DISTANCE = 300;
|
|
91
|
+
const LAYER_DIRECTIONS = {
|
|
92
|
+
SLIDE_FROM_LEFT: RIGHTWARDS,
|
|
93
|
+
SLIDE_FROM_RIGHT: LEFTWARDS,
|
|
94
|
+
SLIDE_FROM_TOP: DOWNWARDS,
|
|
95
|
+
SLIDE_FROM_BOTTOM: UPWARDS
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Where an animating layer is when its easing is at `position`. A layer coming in fades in as it
|
|
99
|
+
* slides the last stretch to its place; one going out keeps moving the same way as it fades.
|
|
100
|
+
*/
|
|
101
|
+
function layerFrame(animation, position) {
|
|
102
|
+
const opacity = clamp01(animation.phase === "IN" ? position : 1 - position);
|
|
103
|
+
if (animation.style === "FADE") return {
|
|
104
|
+
x: 0,
|
|
105
|
+
y: 0,
|
|
106
|
+
opacity
|
|
107
|
+
};
|
|
108
|
+
const offset = 300 * (animation.phase === "IN" ? position - 1 : position);
|
|
109
|
+
return {
|
|
110
|
+
...along(LAYER_DIRECTIONS[animation.style], offset),
|
|
111
|
+
opacity
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Where a layer is drawn before its step has played, or after. */
|
|
115
|
+
function layerAtRest(animation, played) {
|
|
116
|
+
return {
|
|
117
|
+
x: 0,
|
|
118
|
+
y: 0,
|
|
119
|
+
opacity: (animation.phase === "IN" ? played : !played) ? 1 : 0
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/** The transitions Figma's panel offers, each but the first three in four directions. */
|
|
123
|
+
const SLIDE_TRANSITION_KINDS = [
|
|
124
|
+
"NONE",
|
|
125
|
+
"SMART_ANIMATE",
|
|
126
|
+
"DISSOLVE",
|
|
127
|
+
"PUSH",
|
|
128
|
+
"SLIDE_IN",
|
|
129
|
+
"SLIDE_OUT",
|
|
130
|
+
"MOVE_IN",
|
|
131
|
+
"MOVE_OUT"
|
|
132
|
+
];
|
|
133
|
+
/** Which way a transition or a layer moves, as Figma's arrows show it. */
|
|
134
|
+
const MOTION_DIRECTIONS = [
|
|
135
|
+
"LEFT",
|
|
136
|
+
"RIGHT",
|
|
137
|
+
"DOWN",
|
|
138
|
+
"UP"
|
|
139
|
+
];
|
|
140
|
+
/** The record names' prefix for each kind that moves. */
|
|
141
|
+
const KIND_PREFIXES = {
|
|
142
|
+
PUSH: "PUSH_FROM_",
|
|
143
|
+
SLIDE_IN: "SLIDE_FROM_",
|
|
144
|
+
SLIDE_OUT: "SLIDE_OUT_TO_",
|
|
145
|
+
MOVE_IN: "MOVE_FROM_",
|
|
146
|
+
MOVE_OUT: "MOVE_OUT_TO_"
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* The side a record names for a way of moving: what moves rightwards comes from the left, and,
|
|
150
|
+
* as Figma names them, an `OUT_TO_LEFT` moves rightwards too.
|
|
151
|
+
*/
|
|
152
|
+
const SIDES = {
|
|
153
|
+
RIGHT: "LEFT",
|
|
154
|
+
LEFT: "RIGHT",
|
|
155
|
+
DOWN: "TOP",
|
|
156
|
+
UP: "BOTTOM"
|
|
157
|
+
};
|
|
158
|
+
function directionName(direction) {
|
|
159
|
+
if (direction[0] > 0) return "RIGHT";
|
|
160
|
+
if (direction[0] < 0) return "LEFT";
|
|
161
|
+
return direction[1] > 0 ? "DOWN" : "UP";
|
|
162
|
+
}
|
|
163
|
+
/** A style's kind, as Figma's panel lists it. */
|
|
164
|
+
function transitionKind(style) {
|
|
165
|
+
for (const [kind, prefix] of Object.entries(KIND_PREFIXES)) if (style.startsWith(prefix)) return kind;
|
|
166
|
+
return style === "NONE" || style === "SMART_ANIMATE" ? style : "DISSOLVE";
|
|
167
|
+
}
|
|
168
|
+
/** Which way a style moves its slides, or null for one that does not move them. */
|
|
169
|
+
function transitionDirection(style) {
|
|
170
|
+
return transitionKind(style) in KIND_PREFIXES ? directionName(directionOf(style)) : null;
|
|
171
|
+
}
|
|
172
|
+
/** The style of a kind moving `direction`; a kind that does not move ignores it. */
|
|
173
|
+
function transitionStyle(kind, direction) {
|
|
174
|
+
if (kind === "NONE" || kind === "SMART_ANIMATE" || kind === "DISSOLVE") return kind;
|
|
175
|
+
return `${KIND_PREFIXES[kind]}${SIDES[direction]}`;
|
|
176
|
+
}
|
|
177
|
+
/** Which way a layer animation moves its layer, or null for a fade. */
|
|
178
|
+
function layerAnimationDirection(style) {
|
|
179
|
+
return style === "FADE" ? null : directionName(LAYER_DIRECTIONS[style]);
|
|
180
|
+
}
|
|
181
|
+
/** The layer animation that slides its layer `direction`, or fades it with null. */
|
|
182
|
+
function layerAnimationStyle(direction) {
|
|
183
|
+
return direction ? `SLIDE_FROM_${SIDES[direction]}` : "FADE";
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
export { LAYER_SLIDE_DISTANCE, MOTION_DIRECTIONS, SLIDE_TRANSITION_KINDS, layerAnimationDirection, layerAnimationStyle, layerAtRest, layerFrame, transitionDirection, transitionFrames, transitionKind, transitionStyle };
|
|
187
|
+
|
|
188
|
+
//# sourceMappingURL=playback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback.js","names":[],"sources":["../../src/slides/playback.ts"],"sourcesContent":["import type { Vector } from '../primitives'\nimport type { LayerAnimation, SlideTransitionStyle } from './types'\n\n/**\n * How a slide is drawn at a moment of a transition: moved by fractions of its own width and\n * height, faded, and darkened towards black.\n */\nexport interface SlideFrame {\n x: number\n y: number\n opacity: number\n /** How dark: 0 is the slide as it is, 1 black. */\n dim: number\n}\n\n/** The two slides of a transition, the one drawn first below the other. */\nexport interface TransitionFrames {\n from: SlideFrame\n to: SlideFrame\n /** Which slide is drawn on top. */\n above: 'from' | 'to'\n}\n\n/** How far the slide underneath moves in Slide in and Slide out, as Figma moves it. */\nconst PARALLAX = 0.25\n/** How dark the slide underneath gets in Slide in and Slide out. */\nconst UNDERNEATH_DIM = 0.5\n\ntype Direction = readonly [number, number]\nconst RIGHTWARDS: Direction = [1, 0]\nconst LEFTWARDS: Direction = [-1, 0]\nconst DOWNWARDS: Direction = [0, 1]\nconst UPWARDS: Direction = [0, -1]\n\n/**\n * The way a style moves its slides. A `FROM` side is the side the slide comes from. Figma's `OUT_TO`\n * names are mirrored: its panel shows SLIDE_OUT_TO_LEFT as → and plays it moving right.\n */\nfunction directionOf(style: SlideTransitionStyle): Direction {\n if (style.endsWith('FROM_LEFT') || style.endsWith('OUT_TO_LEFT')) return RIGHTWARDS\n if (style.endsWith('FROM_RIGHT') || style.endsWith('OUT_TO_RIGHT')) return LEFTWARDS\n if (style.endsWith('FROM_TOP') || style.endsWith('OUT_TO_TOP')) return DOWNWARDS\n return UPWARDS\n}\n\nfunction clamp01(value: number): number {\n return Math.min(1, Math.max(0, value))\n}\n\n/** A direction scaled by `amount`, with no negative zero where the direction has no part. */\nfunction along(direction: Direction, amount: number): Vector {\n return { x: direction[0] * amount || 0, y: direction[1] * amount || 0 }\n}\n\nfunction frame(direction: Direction, offset: number, dim = 0, opacity = 1): SlideFrame {\n return { ...along(direction, offset), opacity, dim: clamp01(dim) }\n}\n\nconst STILL: SlideFrame = { x: 0, y: 0, opacity: 1, dim: 0 }\n\n/**\n * Where the slides of a transition are when its easing is at `position`: 0 at the start, 1 at the\n * end, past 1 while a spring overshoots. Smart animate plays as Dissolve for now.\n */\nexport function transitionFrames(style: SlideTransitionStyle, position: number): TransitionFrames {\n const p = position\n if (style === 'NONE') return { from: STILL, to: STILL, above: 'to' }\n if (style === 'DISSOLVE' || style === 'SMART_ANIMATE')\n return { from: STILL, to: { ...STILL, opacity: clamp01(p) }, above: 'to' }\n const direction = directionOf(style)\n if (style.startsWith('PUSH_'))\n return { from: frame(direction, p), to: frame(direction, p - 1), above: 'to' }\n if (style.startsWith('MOVE_FROM_'))\n return { from: STILL, to: frame(direction, p - 1), above: 'to' }\n if (style.startsWith('MOVE_OUT_')) return { from: frame(direction, p), to: STILL, above: 'from' }\n if (style.startsWith('SLIDE_FROM_')) {\n return {\n from: frame(direction, PARALLAX * p, UNDERNEATH_DIM * p),\n to: frame(direction, p - 1),\n above: 'to'\n }\n }\n return {\n from: frame(direction, p),\n to: frame(direction, PARALLAX * (p - 1), UNDERNEATH_DIM * (1 - p)),\n above: 'from'\n }\n}\n\n/** How far, in slide pixels, a layer slides on or off, whatever its size, as in Figma. */\nexport const LAYER_SLIDE_DISTANCE = 300\n\n/** Where a layer animating onto or off its slide is drawn, relative to where it is. */\nexport interface LayerFrame {\n x: number\n y: number\n opacity: number\n}\n\nconst LAYER_DIRECTIONS: Record<Exclude<LayerAnimation['style'], 'FADE'>, Direction> = {\n SLIDE_FROM_LEFT: RIGHTWARDS,\n SLIDE_FROM_RIGHT: LEFTWARDS,\n SLIDE_FROM_TOP: DOWNWARDS,\n SLIDE_FROM_BOTTOM: UPWARDS\n}\n\n/**\n * Where an animating layer is when its easing is at `position`. A layer coming in fades in as it\n * slides the last stretch to its place; one going out keeps moving the same way as it fades.\n */\nexport function layerFrame(\n animation: Pick<LayerAnimation, 'style' | 'phase'>,\n position: number\n): LayerFrame {\n const shown = animation.phase === 'IN' ? position : 1 - position\n const opacity = clamp01(shown)\n if (animation.style === 'FADE') return { x: 0, y: 0, opacity }\n const offset = LAYER_SLIDE_DISTANCE * (animation.phase === 'IN' ? position - 1 : position)\n return { ...along(LAYER_DIRECTIONS[animation.style], offset), opacity }\n}\n\n/** Where a layer is drawn before its step has played, or after. */\nexport function layerAtRest(animation: Pick<LayerAnimation, 'phase'>, played: boolean): LayerFrame {\n const shown = animation.phase === 'IN' ? played : !played\n return { x: 0, y: 0, opacity: shown ? 1 : 0 }\n}\n\n/** The transitions Figma's panel offers, each but the first three in four directions. */\nexport const SLIDE_TRANSITION_KINDS = [\n 'NONE',\n 'SMART_ANIMATE',\n 'DISSOLVE',\n 'PUSH',\n 'SLIDE_IN',\n 'SLIDE_OUT',\n 'MOVE_IN',\n 'MOVE_OUT'\n] as const\nexport type SlideTransitionKind = (typeof SLIDE_TRANSITION_KINDS)[number]\n\n/** Which way a transition or a layer moves, as Figma's arrows show it. */\nexport const MOTION_DIRECTIONS = ['LEFT', 'RIGHT', 'DOWN', 'UP'] as const\nexport type MotionDirection = (typeof MOTION_DIRECTIONS)[number]\n\n/** The record names' prefix for each kind that moves. */\nconst KIND_PREFIXES = {\n PUSH: 'PUSH_FROM_',\n SLIDE_IN: 'SLIDE_FROM_',\n SLIDE_OUT: 'SLIDE_OUT_TO_',\n MOVE_IN: 'MOVE_FROM_',\n MOVE_OUT: 'MOVE_OUT_TO_'\n} as const\n\n/**\n * The side a record names for a way of moving: what moves rightwards comes from the left, and,\n * as Figma names them, an `OUT_TO_LEFT` moves rightwards too.\n */\nconst SIDES: Record<MotionDirection, 'LEFT' | 'RIGHT' | 'TOP' | 'BOTTOM'> = {\n RIGHT: 'LEFT',\n LEFT: 'RIGHT',\n DOWN: 'TOP',\n UP: 'BOTTOM'\n}\n\nfunction directionName(direction: Direction): MotionDirection {\n if (direction[0] > 0) return 'RIGHT'\n if (direction[0] < 0) return 'LEFT'\n return direction[1] > 0 ? 'DOWN' : 'UP'\n}\n\n/** A style's kind, as Figma's panel lists it. */\nexport function transitionKind(style: SlideTransitionStyle): SlideTransitionKind {\n for (const [kind, prefix] of Object.entries(KIND_PREFIXES))\n if (style.startsWith(prefix)) return kind as SlideTransitionKind\n return style === 'NONE' || style === 'SMART_ANIMATE' ? style : 'DISSOLVE'\n}\n\n/** Which way a style moves its slides, or null for one that does not move them. */\nexport function transitionDirection(style: SlideTransitionStyle): MotionDirection | null {\n return transitionKind(style) in KIND_PREFIXES ? directionName(directionOf(style)) : null\n}\n\n/** The style of a kind moving `direction`; a kind that does not move ignores it. */\nexport function transitionStyle(\n kind: SlideTransitionKind,\n direction: MotionDirection\n): SlideTransitionStyle {\n if (kind === 'NONE' || kind === 'SMART_ANIMATE' || kind === 'DISSOLVE') return kind\n return `${KIND_PREFIXES[kind]}${SIDES[direction]}` as SlideTransitionStyle\n}\n\n/** Which way a layer animation moves its layer, or null for a fade. */\nexport function layerAnimationDirection(style: LayerAnimation['style']): MotionDirection | null {\n return style === 'FADE' ? null : directionName(LAYER_DIRECTIONS[style])\n}\n\n/** The layer animation that slides its layer `direction`, or fades it with null. */\nexport function layerAnimationStyle(direction: MotionDirection | null): LayerAnimation['style'] {\n return direction ? `SLIDE_FROM_${SIDES[direction]}` : 'FADE'\n}\n"],"mappings":";;AAwBA,MAAM,WAAW;;AAEjB,MAAM,iBAAiB;AAGvB,MAAM,aAAwB,CAAC,GAAG,CAAC;AACnC,MAAM,YAAuB,CAAC,IAAI,CAAC;AACnC,MAAM,YAAuB,CA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