motion 12.18.0 → 12.18.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/cjs/mini.js +7 -1063
- package/dist/es/debug.mjs +1 -0
- package/dist/es/index.mjs +1 -0
- package/dist/es/mini.mjs +1 -0
- package/dist/es/react-client.mjs +2 -0
- package/dist/es/react-m.mjs +2 -0
- package/dist/es/react-mini.mjs +2 -0
- package/dist/es/react.mjs +2 -0
- package/dist/motion.js +1 -1
- package/mini/package.json +1 -1
- package/package.json +11 -11
- package/react/package.json +1 -1
- package/react-client/package.json +1 -1
- package/react-m/package.json +1 -1
- package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +0 -34
- package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +0 -19
- package/dist/es/framer-motion/dist/es/animation/animate/sequence.mjs +0 -14
- package/dist/es/framer-motion/dist/es/animation/animate/single-value.mjs +0 -11
- package/dist/es/framer-motion/dist/es/animation/animate/subject.mjs +0 -52
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +0 -112
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +0 -13
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +0 -12
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +0 -12
- package/dist/es/framer-motion/dist/es/animation/hooks/animation-controls.mjs +0 -80
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animate-style.mjs +0 -17
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animate.mjs +0 -17
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animated-state.mjs +0 -64
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animation.mjs +0 -41
- package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +0 -102
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +0 -85
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +0 -65
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element.mjs +0 -26
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +0 -6
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +0 -7
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/handoff.mjs +0 -38
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +0 -171
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/store-id.mjs +0 -8
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/store.mjs +0 -4
- package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +0 -256
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-repeat-duration.mjs +0 -5
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +0 -23
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/edit.mjs +0 -31
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/normalize-times.mjs +0 -13
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/sort.mjs +0 -14
- package/dist/es/framer-motion/dist/es/animation/utils/create-visual-element.mjs +0 -45
- package/dist/es/framer-motion/dist/es/animation/utils/default-transitions.mjs +0 -40
- package/dist/es/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +0 -7
- package/dist/es/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +0 -5
- package/dist/es/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +0 -5
- package/dist/es/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +0 -10
- package/dist/es/framer-motion/dist/es/animation/utils/stagger.mjs +0 -26
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs +0 -87
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs +0 -64
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +0 -166
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence-data.mjs +0 -9
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs +0 -70
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.mjs +0 -14
- package/dist/es/framer-motion/dist/es/components/AnimateSharedLayout.mjs +0 -15
- package/dist/es/framer-motion/dist/es/components/LayoutGroup/index.mjs +0 -32
- package/dist/es/framer-motion/dist/es/components/LazyMotion/index.mjs +0 -68
- package/dist/es/framer-motion/dist/es/components/MotionConfig/index.mjs +0 -48
- package/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs +0 -53
- package/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs +0 -34
- package/dist/es/framer-motion/dist/es/components/Reorder/namespace.mjs +0 -2
- package/dist/es/framer-motion/dist/es/components/Reorder/utils/check-reorder.mjs +0 -24
- package/dist/es/framer-motion/dist/es/context/DeprecatedLayoutGroupContext.mjs +0 -10
- package/dist/es/framer-motion/dist/es/context/LayoutGroupContext.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/LazyContext.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/MotionConfigContext.mjs +0 -13
- package/dist/es/framer-motion/dist/es/context/MotionContext/create.mjs +0 -13
- package/dist/es/framer-motion/dist/es/context/MotionContext/index.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/MotionContext/utils.mjs +0 -17
- package/dist/es/framer-motion/dist/es/context/PresenceContext.mjs +0 -10
- package/dist/es/framer-motion/dist/es/context/ReorderContext.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs +0 -9
- package/dist/es/framer-motion/dist/es/events/add-dom-event.mjs +0 -6
- package/dist/es/framer-motion/dist/es/events/add-pointer-event.mjs +0 -8
- package/dist/es/framer-motion/dist/es/events/event-info.mjs +0 -15
- package/dist/es/framer-motion/dist/es/events/use-dom-event.mjs +0 -34
- package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +0 -479
- package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +0 -27
- package/dist/es/framer-motion/dist/es/gestures/drag/use-drag-controls.mjs +0 -88
- package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +0 -129
- package/dist/es/framer-motion/dist/es/gestures/focus.mjs +0 -41
- package/dist/es/framer-motion/dist/es/gestures/hover.mjs +0 -30
- package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +0 -156
- package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +0 -50
- package/dist/es/framer-motion/dist/es/gestures/press.mjs +0 -33
- package/dist/es/framer-motion/dist/es/motion/features/Feature.mjs +0 -9
- package/dist/es/framer-motion/dist/es/motion/features/animation/exit.mjs +0 -36
- package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +0 -40
- package/dist/es/framer-motion/dist/es/motion/features/animations.mjs +0 -13
- package/dist/es/framer-motion/dist/es/motion/features/definitions.mjs +0 -28
- package/dist/es/framer-motion/dist/es/motion/features/drag.mjs +0 -17
- package/dist/es/framer-motion/dist/es/motion/features/gestures.mjs +0 -21
- package/dist/es/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs +0 -135
- package/dist/es/framer-motion/dist/es/motion/features/layout.mjs +0 -11
- package/dist/es/framer-motion/dist/es/motion/features/load-features.mjs +0 -12
- package/dist/es/framer-motion/dist/es/motion/features/viewport/index.mjs +0 -72
- package/dist/es/framer-motion/dist/es/motion/features/viewport/observers.mjs +0 -49
- package/dist/es/framer-motion/dist/es/motion/index.mjs +0 -101
- package/dist/es/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +0 -11
- package/dist/es/framer-motion/dist/es/motion/utils/is-motion-component.mjs +0 -12
- package/dist/es/framer-motion/dist/es/motion/utils/symbol.mjs +0 -3
- package/dist/es/framer-motion/dist/es/motion/utils/unwrap-motion-component.mjs +0 -17
- package/dist/es/framer-motion/dist/es/motion/utils/use-motion-ref.mjs +0 -38
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +0 -133
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-state.mjs +0 -79
- package/dist/es/framer-motion/dist/es/motion/utils/valid-prop.mjs +0 -57
- package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +0 -91
- package/dist/es/framer-motion/dist/es/projection/geometry/conversion.mjs +0 -33
- package/dist/es/framer-motion/dist/es/projection/geometry/copy.mjs +0 -31
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-apply.mjs +0 -119
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-calc.mjs +0 -52
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-remove.mjs +0 -54
- package/dist/es/framer-motion/dist/es/projection/geometry/models.mjs +0 -17
- package/dist/es/framer-motion/dist/es/projection/geometry/utils.mjs +0 -31
- package/dist/es/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs +0 -13
- package/dist/es/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs +0 -27
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +0 -1605
- package/dist/es/framer-motion/dist/es/projection/node/group.mjs +0 -24
- package/dist/es/framer-motion/dist/es/projection/node/state.mjs +0 -19
- package/dist/es/framer-motion/dist/es/projection/shared/stack.mjs +0 -112
- package/dist/es/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +0 -41
- package/dist/es/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +0 -35
- package/dist/es/framer-motion/dist/es/projection/styles/scale-correction.mjs +0 -13
- package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +0 -49
- package/dist/es/framer-motion/dist/es/projection/use-instant-layout-transition.mjs +0 -14
- package/dist/es/framer-motion/dist/es/projection/use-reset-projection.mjs +0 -14
- package/dist/es/framer-motion/dist/es/projection/utils/each-axis.mjs +0 -5
- package/dist/es/framer-motion/dist/es/projection/utils/has-transform.mjs +0 -26
- package/dist/es/framer-motion/dist/es/projection/utils/measure.mjs +0 -17
- package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +0 -478
- package/dist/es/framer-motion/dist/es/render/components/create-factory.mjs +0 -23
- package/dist/es/framer-motion/dist/es/render/components/create-proxy.mjs +0 -38
- package/dist/es/framer-motion/dist/es/render/components/m/create.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/components/m/elements.mjs +0 -227
- package/dist/es/framer-motion/dist/es/render/components/m/proxy.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/components/motion/create.mjs +0 -15
- package/dist/es/framer-motion/dist/es/render/components/motion/elements.mjs +0 -194
- package/dist/es/framer-motion/dist/es/render/components/motion/proxy.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +0 -43
- package/dist/es/framer-motion/dist/es/render/dom/create-visual-element.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/features-animation.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/features-max.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/features-min.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-animation.mjs +0 -17
- package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-function.mjs +0 -23
- package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/scroll/info.mjs +0 -56
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +0 -45
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +0 -60
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +0 -47
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +0 -35
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +0 -20
- package/dist/es/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +0 -48
- package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +0 -81
- package/dist/es/framer-motion/dist/es/render/dom/scroll/utils/get-timeline.mjs +0 -30
- package/dist/es/framer-motion/dist/es/render/dom/use-render.mjs +0 -33
- package/dist/es/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/dom/utils/filter-props.mjs +0 -59
- package/dist/es/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs +0 -30
- package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +0 -43
- package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +0 -44
- package/dist/es/framer-motion/dist/es/render/html/config-motion.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/html/use-props.mjs +0 -57
- package/dist/es/framer-motion/dist/es/render/html/utils/build-styles.mjs +0 -65
- package/dist/es/framer-motion/dist/es/render/html/utils/build-transform.mjs +0 -62
- package/dist/es/framer-motion/dist/es/render/html/utils/create-render-state.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/html/utils/render.mjs +0 -9
- package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +0 -19
- package/dist/es/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +0 -41
- package/dist/es/framer-motion/dist/es/render/store.mjs +0 -3
- package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +0 -45
- package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/svg/lowercase-elements.mjs +0 -33
- package/dist/es/framer-motion/dist/es/render/svg/use-props.mjs +0 -24
- package/dist/es/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +0 -57
- package/dist/es/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +0 -30
- package/dist/es/framer-motion/dist/es/render/svg/utils/create-render-state.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +0 -3
- package/dist/es/framer-motion/dist/es/render/svg/utils/path.mjs +0 -32
- package/dist/es/framer-motion/dist/es/render/svg/utils/render.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +0 -19
- package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +0 -342
- package/dist/es/framer-motion/dist/es/render/utils/compare-by-depth.mjs +0 -3
- package/dist/es/framer-motion/dist/es/render/utils/flat-tree.mjs +0 -24
- package/dist/es/framer-motion/dist/es/render/utils/get-variant-context.mjs +0 -28
- package/dist/es/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +0 -13
- package/dist/es/framer-motion/dist/es/render/utils/is-variant-label.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +0 -51
- package/dist/es/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +0 -36
- package/dist/es/framer-motion/dist/es/render/utils/setters.mjs +0 -31
- package/dist/es/framer-motion/dist/es/render/utils/variant-props.mjs +0 -12
- package/dist/es/framer-motion/dist/es/utils/delay.mjs +0 -24
- package/dist/es/framer-motion/dist/es/utils/distance.mjs +0 -9
- package/dist/es/framer-motion/dist/es/utils/get-context-window.mjs +0 -6
- package/dist/es/framer-motion/dist/es/utils/is-browser.mjs +0 -3
- package/dist/es/framer-motion/dist/es/utils/is-ref-object.mjs +0 -7
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/index.mjs +0 -19
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/state.mjs +0 -5
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs +0 -19
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.mjs +0 -47
- package/dist/es/framer-motion/dist/es/utils/shallow-compare.mjs +0 -14
- package/dist/es/framer-motion/dist/es/utils/use-animation-frame.mjs +0 -21
- package/dist/es/framer-motion/dist/es/utils/use-constant.mjs +0 -18
- package/dist/es/framer-motion/dist/es/utils/use-cycle.mjs +0 -47
- package/dist/es/framer-motion/dist/es/utils/use-force-update.mjs +0 -19
- package/dist/es/framer-motion/dist/es/utils/use-in-view.mjs +0 -23
- package/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs +0 -41
- package/dist/es/framer-motion/dist/es/utils/use-is-mounted.mjs +0 -15
- package/dist/es/framer-motion/dist/es/utils/use-isomorphic-effect.mjs +0 -6
- package/dist/es/framer-motion/dist/es/utils/use-motion-value-event.mjs +0 -13
- package/dist/es/framer-motion/dist/es/utils/use-unmount-effect.mjs +0 -7
- package/dist/es/framer-motion/dist/es/value/scroll/use-element-scroll.mjs +0 -14
- package/dist/es/framer-motion/dist/es/value/scroll/use-viewport-scroll.mjs +0 -14
- package/dist/es/framer-motion/dist/es/value/use-combine-values.mjs +0 -37
- package/dist/es/framer-motion/dist/es/value/use-computed.mjs +0 -19
- package/dist/es/framer-motion/dist/es/value/use-inverted-scale.mjs +0 -52
- package/dist/es/framer-motion/dist/es/value/use-motion-template.mjs +0 -45
- package/dist/es/framer-motion/dist/es/value/use-motion-value.mjs +0 -38
- package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +0 -39
- package/dist/es/framer-motion/dist/es/value/use-spring.mjs +0 -22
- package/dist/es/framer-motion/dist/es/value/use-time.mjs +0 -10
- package/dist/es/framer-motion/dist/es/value/use-transform.mjs +0 -29
- package/dist/es/framer-motion/dist/es/value/use-velocity.mjs +0 -35
- package/dist/es/framer-motion/dist/es/value/use-will-change/WillChangeMotionValue.mjs +0 -21
- package/dist/es/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +0 -20
- package/dist/es/framer-motion/dist/es/value/use-will-change/index.mjs +0 -8
- package/dist/es/framer-motion/dist/es/value/use-will-change/is.mjs +0 -7
- package/dist/es/framer-motion/dist/es/value/utils/resolve-motion-value.mjs +0 -12
- package/dist/es/motion/lib/debug.mjs +0 -1
- package/dist/es/motion/lib/index.mjs +0 -131
- package/dist/es/motion/lib/mini.mjs +0 -2
- package/dist/es/motion/lib/react-client.mjs +0 -3
- package/dist/es/motion/lib/react-m.mjs +0 -3
- package/dist/es/motion/lib/react-mini.mjs +0 -2
- package/dist/es/motion/lib/react.mjs +0 -204
- package/dist/es/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs +0 -175
- package/dist/es/motion-dom/dist/es/animation/GroupAnimation.mjs +0 -72
- package/dist/es/motion-dom/dist/es/animation/GroupAnimationWithThen.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/JSAnimation.mjs +0 -348
- package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +0 -158
- package/dist/es/motion-dom/dist/es/animation/NativeAnimationExtended.mjs +0 -65
- package/dist/es/motion-dom/dist/es/animation/NativeAnimationWrapper.mjs +0 -14
- package/dist/es/motion-dom/dist/es/animation/drivers/frame.mjs +0 -17
- package/dist/es/motion-dom/dist/es/animation/generators/inertia.mjs +0 -87
- package/dist/es/motion-dom/dist/es/animation/generators/keyframes.mjs +0 -51
- package/dist/es/motion-dom/dist/es/animation/generators/spring/defaults.mjs +0 -27
- package/dist/es/motion-dom/dist/es/animation/generators/spring/find.mjs +0 -86
- package/dist/es/motion-dom/dist/es/animation/generators/spring/index.mjs +0 -176
- package/dist/es/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs +0 -17
- package/dist/es/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs +0 -19
- package/dist/es/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +0 -5
- package/dist/es/motion-dom/dist/es/animation/generators/utils/velocity.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs +0 -131
- package/dist/es/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs +0 -147
- package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +0 -11
- package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/default.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/fill.mjs +0 -12
- package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/time.mjs +0 -5
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/apply-px-defaults.mjs +0 -11
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs +0 -7
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/is-none.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/make-none-animatable.mjs +0 -30
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/unit-conversion.mjs +0 -36
- package/dist/es/motion-dom/dist/es/animation/utils/WithPromise.mjs +0 -26
- package/dist/es/motion-dom/dist/es/animation/utils/active-animations.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/utils/can-animate.mjs +0 -42
- package/dist/es/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs +0 -42
- package/dist/es/motion-dom/dist/es/animation/utils/get-value-transition.mjs +0 -7
- package/dist/es/motion-dom/dist/es/animation/utils/is-animatable.mjs +0 -30
- package/dist/es/motion-dom/dist/es/animation/utils/is-css-variable.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/utils/replace-transition-type.mjs +0 -18
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs +0 -3
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +0 -14
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +0 -28
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/supported.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs +0 -39
- package/dist/es/motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs +0 -13
- package/dist/es/motion-dom/dist/es/animation/waapi/supports/waapi.mjs +0 -37
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs +0 -14
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/linear.mjs +0 -12
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/px-values.mjs +0 -39
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs +0 -20
- package/dist/es/motion-dom/dist/es/effects/MotionValueState.mjs +0 -47
- package/dist/es/motion-dom/dist/es/effects/attr/index.mjs +0 -41
- package/dist/es/motion-dom/dist/es/effects/prop/index.mjs +0 -9
- package/dist/es/motion-dom/dist/es/effects/style/index.mjs +0 -52
- package/dist/es/motion-dom/dist/es/effects/style/transform.mjs +0 -38
- package/dist/es/motion-dom/dist/es/effects/svg/index.mjs +0 -41
- package/dist/es/motion-dom/dist/es/effects/utils/create-dom-effect.mjs +0 -18
- package/dist/es/motion-dom/dist/es/effects/utils/create-effect.mjs +0 -21
- package/dist/es/motion-dom/dist/es/frameloop/batcher.mjs +0 -71
- package/dist/es/motion-dom/dist/es/frameloop/frame.mjs +0 -6
- package/dist/es/motion-dom/dist/es/frameloop/index-legacy.mjs +0 -20
- package/dist/es/motion-dom/dist/es/frameloop/microtask.mjs +0 -6
- package/dist/es/motion-dom/dist/es/frameloop/order.mjs +0 -12
- package/dist/es/motion-dom/dist/es/frameloop/render-step.mjs +0 -92
- package/dist/es/motion-dom/dist/es/frameloop/sync-time.mjs +0 -31
- package/dist/es/motion-dom/dist/es/gestures/drag/state/is-active.mjs +0 -9
- package/dist/es/motion-dom/dist/es/gestures/drag/state/set-active.mjs +0 -28
- package/dist/es/motion-dom/dist/es/gestures/hover.mjs +0 -37
- package/dist/es/motion-dom/dist/es/gestures/press/index.mjs +0 -83
- package/dist/es/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.mjs +0 -13
- package/dist/es/motion-dom/dist/es/gestures/press/utils/keyboard.mjs +0 -38
- package/dist/es/motion-dom/dist/es/gestures/press/utils/state.mjs +0 -3
- package/dist/es/motion-dom/dist/es/gestures/utils/is-node-or-child.mjs +0 -20
- package/dist/es/motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs +0 -18
- package/dist/es/motion-dom/dist/es/gestures/utils/setup.mjs +0 -15
- package/dist/es/motion-dom/dist/es/render/dom/is-css-var.mjs +0 -3
- package/dist/es/motion-dom/dist/es/render/dom/parse-transform.mjs +0 -83
- package/dist/es/motion-dom/dist/es/render/dom/style-computed.mjs +0 -10
- package/dist/es/motion-dom/dist/es/render/dom/style-set.mjs +0 -9
- package/dist/es/motion-dom/dist/es/render/dom/utils/camel-to-dash.mjs +0 -5
- package/dist/es/motion-dom/dist/es/render/utils/keys-position.mjs +0 -13
- package/dist/es/motion-dom/dist/es/render/utils/keys-transform.mjs +0 -28
- package/dist/es/motion-dom/dist/es/resize/handle-element.mjs +0 -63
- package/dist/es/motion-dom/dist/es/resize/handle-window.mjs +0 -31
- package/dist/es/motion-dom/dist/es/resize/index.mjs +0 -8
- package/dist/es/motion-dom/dist/es/scroll/observe.mjs +0 -18
- package/dist/es/motion-dom/dist/es/stats/animation-count.mjs +0 -7
- package/dist/es/motion-dom/dist/es/stats/buffer.mjs +0 -6
- package/dist/es/motion-dom/dist/es/stats/index.mjs +0 -117
- package/dist/es/motion-dom/dist/es/utils/interpolate.mjs +0 -79
- package/dist/es/motion-dom/dist/es/utils/is-html-element.mjs +0 -11
- package/dist/es/motion-dom/dist/es/utils/is-svg-element.mjs +0 -11
- package/dist/es/motion-dom/dist/es/utils/is-svg-svg-element.mjs +0 -11
- package/dist/es/motion-dom/dist/es/utils/mix/color.mjs +0 -47
- package/dist/es/motion-dom/dist/es/utils/mix/complex.mjs +0 -93
- package/dist/es/motion-dom/dist/es/utils/mix/immediate.mjs +0 -5
- package/dist/es/motion-dom/dist/es/utils/mix/index.mjs +0 -14
- package/dist/es/motion-dom/dist/es/utils/mix/number.mjs +0 -26
- package/dist/es/motion-dom/dist/es/utils/mix/visibility.mjs +0 -16
- package/dist/es/motion-dom/dist/es/utils/resolve-elements.mjs +0 -17
- package/dist/es/motion-dom/dist/es/utils/supports/flags.mjs +0 -7
- package/dist/es/motion-dom/dist/es/utils/supports/linear-easing.mjs +0 -15
- package/dist/es/motion-dom/dist/es/utils/supports/memo.mjs +0 -9
- package/dist/es/motion-dom/dist/es/utils/supports/scroll-timeline.mjs +0 -5
- package/dist/es/motion-dom/dist/es/utils/transform.mjs +0 -14
- package/dist/es/motion-dom/dist/es/value/index.mjs +0 -329
- package/dist/es/motion-dom/dist/es/value/map-value.mjs +0 -46
- package/dist/es/motion-dom/dist/es/value/spring-value.mjs +0 -72
- package/dist/es/motion-dom/dist/es/value/subscribe-value.mjs +0 -13
- package/dist/es/motion-dom/dist/es/value/transform-value.mjs +0 -35
- package/dist/es/motion-dom/dist/es/value/types/auto.mjs +0 -9
- package/dist/es/motion-dom/dist/es/value/types/color/hex.mjs +0 -40
- package/dist/es/motion-dom/dist/es/value/types/color/hsla-to-rgba.mjs +0 -42
- package/dist/es/motion-dom/dist/es/value/types/color/hsla.mjs +0 -22
- package/dist/es/motion-dom/dist/es/value/types/color/index.mjs +0 -32
- package/dist/es/motion-dom/dist/es/value/types/color/rgba.mjs +0 -25
- package/dist/es/motion-dom/dist/es/value/types/color/utils.mjs +0 -29
- package/dist/es/motion-dom/dist/es/value/types/complex/filter.mjs +0 -30
- package/dist/es/motion-dom/dist/es/value/types/complex/index.mjs +0 -91
- package/dist/es/motion-dom/dist/es/value/types/dimensions.mjs +0 -15
- package/dist/es/motion-dom/dist/es/value/types/int.mjs +0 -8
- package/dist/es/motion-dom/dist/es/value/types/maps/defaults.mjs +0 -30
- package/dist/es/motion-dom/dist/es/value/types/maps/number.mjs +0 -50
- package/dist/es/motion-dom/dist/es/value/types/maps/transform.mjs +0 -31
- package/dist/es/motion-dom/dist/es/value/types/numbers/index.mjs +0 -17
- package/dist/es/motion-dom/dist/es/value/types/numbers/units.mjs +0 -18
- package/dist/es/motion-dom/dist/es/value/types/test.mjs +0 -6
- package/dist/es/motion-dom/dist/es/value/types/utils/animatable-none.mjs +0 -15
- package/dist/es/motion-dom/dist/es/value/types/utils/color-regex.mjs +0 -3
- package/dist/es/motion-dom/dist/es/value/types/utils/find.mjs +0 -15
- package/dist/es/motion-dom/dist/es/value/types/utils/float-regex.mjs +0 -3
- package/dist/es/motion-dom/dist/es/value/types/utils/get-as-type.mjs +0 -10
- package/dist/es/motion-dom/dist/es/value/types/utils/is-nullish.mjs +0 -5
- package/dist/es/motion-dom/dist/es/value/types/utils/sanitize.mjs +0 -5
- package/dist/es/motion-dom/dist/es/value/types/utils/single-color-regex.mjs +0 -3
- package/dist/es/motion-dom/dist/es/value/utils/is-motion-value.mjs +0 -3
- package/dist/es/motion-dom/dist/es/view/index.mjs +0 -64
- package/dist/es/motion-dom/dist/es/view/queue.mjs +0 -52
- package/dist/es/motion-dom/dist/es/view/start.mjs +0 -155
- package/dist/es/motion-dom/dist/es/view/utils/choose-layer-type.mjs +0 -11
- package/dist/es/motion-dom/dist/es/view/utils/css.mjs +0 -32
- package/dist/es/motion-dom/dist/es/view/utils/get-layer-name.mjs +0 -8
- package/dist/es/motion-dom/dist/es/view/utils/get-view-animations.mjs +0 -12
- package/dist/es/motion-dom/dist/es/view/utils/has-target.mjs +0 -5
- package/dist/es/motion-utils/dist/es/array.mjs +0 -21
- package/dist/es/motion-utils/dist/es/clamp.mjs +0 -9
- package/dist/es/motion-utils/dist/es/easing/anticipate.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/back.mjs +0 -9
- package/dist/es/motion-utils/dist/es/easing/circ.mjs +0 -8
- package/dist/es/motion-utils/dist/es/easing/cubic-bezier.mjs +0 -51
- package/dist/es/motion-utils/dist/es/easing/ease.mjs +0 -7
- package/dist/es/motion-utils/dist/es/easing/modifiers/mirror.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/modifiers/reverse.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/steps.mjs +0 -15
- package/dist/es/motion-utils/dist/es/easing/utils/get-easing-for-segment.mjs +0 -8
- package/dist/es/motion-utils/dist/es/easing/utils/is-bezier-definition.mjs +0 -3
- package/dist/es/motion-utils/dist/es/easing/utils/is-easing-array.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/utils/map.mjs +0 -41
- package/dist/es/motion-utils/dist/es/errors.mjs +0 -16
- package/dist/es/motion-utils/dist/es/global-config.mjs +0 -3
- package/dist/es/motion-utils/dist/es/is-numerical-string.mjs +0 -6
- package/dist/es/motion-utils/dist/es/is-object.mjs +0 -5
- package/dist/es/motion-utils/dist/es/is-zero-value-string.mjs +0 -6
- package/dist/es/motion-utils/dist/es/memo.mjs +0 -11
- package/dist/es/motion-utils/dist/es/noop.mjs +0 -4
- package/dist/es/motion-utils/dist/es/pipe.mjs +0 -11
- package/dist/es/motion-utils/dist/es/progress.mjs +0 -19
- package/dist/es/motion-utils/dist/es/subscription-manager.mjs +0 -40
- package/dist/es/motion-utils/dist/es/time-conversion.mjs +0 -12
- package/dist/es/motion-utils/dist/es/velocity-per-second.mjs +0 -11
- package/dist/es/motion-utils/dist/es/warn-once.mjs +0 -14
- package/dist/es/motion-utils/dist/es/wrap.mjs +0 -6
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { time } from '../frameloop/sync-time.mjs';
|
|
2
|
-
import { JSAnimation } from './JSAnimation.mjs';
|
|
3
|
-
import { getFinalKeyframe } from './keyframes/get-final.mjs';
|
|
4
|
-
import { KeyframeResolver, flushKeyframeResolvers } from './keyframes/KeyframesResolver.mjs';
|
|
5
|
-
import { NativeAnimationExtended } from './NativeAnimationExtended.mjs';
|
|
6
|
-
import { canAnimate } from './utils/can-animate.mjs';
|
|
7
|
-
import { WithPromise } from './utils/WithPromise.mjs';
|
|
8
|
-
import { supportsBrowserAnimation } from './waapi/supports/waapi.mjs';
|
|
9
|
-
import { MotionGlobalConfig } from '../../../../motion-utils/dist/es/global-config.mjs';
|
|
10
|
-
import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Maximum time allowed between an animation being created and it being
|
|
14
|
-
* resolved for us to use the latter as the start time.
|
|
15
|
-
*
|
|
16
|
-
* This is to ensure that while we prefer to "start" an animation as soon
|
|
17
|
-
* as it's triggered, we also want to avoid a visual jump if there's a big delay
|
|
18
|
-
* between these two moments.
|
|
19
|
-
*/
|
|
20
|
-
const MAX_RESOLVE_DELAY = 40;
|
|
21
|
-
class AsyncMotionValueAnimation extends WithPromise {
|
|
22
|
-
constructor({ autoplay = true, delay = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", keyframes, name, motionValue, element, ...options }) {
|
|
23
|
-
super();
|
|
24
|
-
/**
|
|
25
|
-
* Bound to support return animation.stop pattern
|
|
26
|
-
*/
|
|
27
|
-
this.stop = () => {
|
|
28
|
-
if (this._animation) {
|
|
29
|
-
this._animation.stop();
|
|
30
|
-
this.stopTimeline?.();
|
|
31
|
-
}
|
|
32
|
-
this.keyframeResolver?.cancel();
|
|
33
|
-
};
|
|
34
|
-
this.createdAt = time.now();
|
|
35
|
-
const optionsWithDefaults = {
|
|
36
|
-
autoplay,
|
|
37
|
-
delay,
|
|
38
|
-
type,
|
|
39
|
-
repeat,
|
|
40
|
-
repeatDelay,
|
|
41
|
-
repeatType,
|
|
42
|
-
name,
|
|
43
|
-
motionValue,
|
|
44
|
-
element,
|
|
45
|
-
...options,
|
|
46
|
-
};
|
|
47
|
-
const KeyframeResolver$1 = element?.KeyframeResolver || KeyframeResolver;
|
|
48
|
-
this.keyframeResolver = new KeyframeResolver$1(keyframes, (resolvedKeyframes, finalKeyframe, forced) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe, optionsWithDefaults, !forced), name, motionValue, element);
|
|
49
|
-
this.keyframeResolver?.scheduleResolve();
|
|
50
|
-
}
|
|
51
|
-
onKeyframesResolved(keyframes, finalKeyframe, options, sync) {
|
|
52
|
-
this.keyframeResolver = undefined;
|
|
53
|
-
const { name, type, velocity, delay, isHandoff, onUpdate } = options;
|
|
54
|
-
this.resolvedAt = time.now();
|
|
55
|
-
/**
|
|
56
|
-
* If we can't animate this value with the resolved keyframes
|
|
57
|
-
* then we should complete it immediately.
|
|
58
|
-
*/
|
|
59
|
-
if (!canAnimate(keyframes, name, type, velocity)) {
|
|
60
|
-
if (MotionGlobalConfig.instantAnimations || !delay) {
|
|
61
|
-
onUpdate?.(getFinalKeyframe(keyframes, options, finalKeyframe));
|
|
62
|
-
}
|
|
63
|
-
keyframes[0] = keyframes[keyframes.length - 1];
|
|
64
|
-
options.duration = 0;
|
|
65
|
-
options.repeat = 0;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Resolve startTime for the animation.
|
|
69
|
-
*
|
|
70
|
-
* This method uses the createdAt and resolvedAt to calculate the
|
|
71
|
-
* animation startTime. *Ideally*, we would use the createdAt time as t=0
|
|
72
|
-
* as the following frame would then be the first frame of the animation in
|
|
73
|
-
* progress, which would feel snappier.
|
|
74
|
-
*
|
|
75
|
-
* However, if there's a delay (main thread work) between the creation of
|
|
76
|
-
* the animation and the first commited frame, we prefer to use resolvedAt
|
|
77
|
-
* to avoid a sudden jump into the animation.
|
|
78
|
-
*/
|
|
79
|
-
const startTime = sync
|
|
80
|
-
? !this.resolvedAt
|
|
81
|
-
? this.createdAt
|
|
82
|
-
: this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY
|
|
83
|
-
? this.resolvedAt
|
|
84
|
-
: this.createdAt
|
|
85
|
-
: undefined;
|
|
86
|
-
const resolvedOptions = {
|
|
87
|
-
startTime,
|
|
88
|
-
finalKeyframe,
|
|
89
|
-
...options,
|
|
90
|
-
keyframes,
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Animate via WAAPI if possible. If this is a handoff animation, the optimised animation will be running via
|
|
94
|
-
* WAAPI. Therefore, this animation must be JS to ensure it runs "under" the
|
|
95
|
-
* optimised animation.
|
|
96
|
-
*/
|
|
97
|
-
const animation = !isHandoff && supportsBrowserAnimation(resolvedOptions)
|
|
98
|
-
? new NativeAnimationExtended({
|
|
99
|
-
...resolvedOptions,
|
|
100
|
-
element: resolvedOptions.motionValue.owner.current,
|
|
101
|
-
})
|
|
102
|
-
: new JSAnimation(resolvedOptions);
|
|
103
|
-
animation.finished.then(() => this.notifyFinished()).catch(noop);
|
|
104
|
-
if (this.pendingTimeline) {
|
|
105
|
-
this.stopTimeline = animation.attachTimeline(this.pendingTimeline);
|
|
106
|
-
this.pendingTimeline = undefined;
|
|
107
|
-
}
|
|
108
|
-
this._animation = animation;
|
|
109
|
-
}
|
|
110
|
-
get finished() {
|
|
111
|
-
if (!this._animation) {
|
|
112
|
-
return this._finished;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
return this.animation.finished;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
then(onResolve, _onReject) {
|
|
119
|
-
return this.finished.finally(onResolve).then(() => { });
|
|
120
|
-
}
|
|
121
|
-
get animation() {
|
|
122
|
-
if (!this._animation) {
|
|
123
|
-
this.keyframeResolver?.resume();
|
|
124
|
-
flushKeyframeResolvers();
|
|
125
|
-
}
|
|
126
|
-
return this._animation;
|
|
127
|
-
}
|
|
128
|
-
get duration() {
|
|
129
|
-
return this.animation.duration;
|
|
130
|
-
}
|
|
131
|
-
get time() {
|
|
132
|
-
return this.animation.time;
|
|
133
|
-
}
|
|
134
|
-
set time(newTime) {
|
|
135
|
-
this.animation.time = newTime;
|
|
136
|
-
}
|
|
137
|
-
get speed() {
|
|
138
|
-
return this.animation.speed;
|
|
139
|
-
}
|
|
140
|
-
get state() {
|
|
141
|
-
return this.animation.state;
|
|
142
|
-
}
|
|
143
|
-
set speed(newSpeed) {
|
|
144
|
-
this.animation.speed = newSpeed;
|
|
145
|
-
}
|
|
146
|
-
get startTime() {
|
|
147
|
-
return this.animation.startTime;
|
|
148
|
-
}
|
|
149
|
-
attachTimeline(timeline) {
|
|
150
|
-
if (this._animation) {
|
|
151
|
-
this.stopTimeline = this.animation.attachTimeline(timeline);
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
this.pendingTimeline = timeline;
|
|
155
|
-
}
|
|
156
|
-
return () => this.stop();
|
|
157
|
-
}
|
|
158
|
-
play() {
|
|
159
|
-
this.animation.play();
|
|
160
|
-
}
|
|
161
|
-
pause() {
|
|
162
|
-
this.animation.pause();
|
|
163
|
-
}
|
|
164
|
-
complete() {
|
|
165
|
-
this.animation.complete();
|
|
166
|
-
}
|
|
167
|
-
cancel() {
|
|
168
|
-
if (this._animation) {
|
|
169
|
-
this.animation.cancel();
|
|
170
|
-
}
|
|
171
|
-
this.keyframeResolver?.cancel();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export { AsyncMotionValueAnimation };
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
class GroupAnimation {
|
|
2
|
-
constructor(animations) {
|
|
3
|
-
// Bound to accomadate common `return animation.stop` pattern
|
|
4
|
-
this.stop = () => this.runAll("stop");
|
|
5
|
-
this.animations = animations.filter(Boolean);
|
|
6
|
-
}
|
|
7
|
-
get finished() {
|
|
8
|
-
return Promise.all(this.animations.map((animation) => animation.finished));
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* TODO: Filter out cancelled or stopped animations before returning
|
|
12
|
-
*/
|
|
13
|
-
getAll(propName) {
|
|
14
|
-
return this.animations[0][propName];
|
|
15
|
-
}
|
|
16
|
-
setAll(propName, newValue) {
|
|
17
|
-
for (let i = 0; i < this.animations.length; i++) {
|
|
18
|
-
this.animations[i][propName] = newValue;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
attachTimeline(timeline) {
|
|
22
|
-
const subscriptions = this.animations.map((animation) => animation.attachTimeline(timeline));
|
|
23
|
-
return () => {
|
|
24
|
-
subscriptions.forEach((cancel, i) => {
|
|
25
|
-
cancel && cancel();
|
|
26
|
-
this.animations[i].stop();
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
get time() {
|
|
31
|
-
return this.getAll("time");
|
|
32
|
-
}
|
|
33
|
-
set time(time) {
|
|
34
|
-
this.setAll("time", time);
|
|
35
|
-
}
|
|
36
|
-
get speed() {
|
|
37
|
-
return this.getAll("speed");
|
|
38
|
-
}
|
|
39
|
-
set speed(speed) {
|
|
40
|
-
this.setAll("speed", speed);
|
|
41
|
-
}
|
|
42
|
-
get state() {
|
|
43
|
-
return this.getAll("state");
|
|
44
|
-
}
|
|
45
|
-
get startTime() {
|
|
46
|
-
return this.getAll("startTime");
|
|
47
|
-
}
|
|
48
|
-
get duration() {
|
|
49
|
-
let max = 0;
|
|
50
|
-
for (let i = 0; i < this.animations.length; i++) {
|
|
51
|
-
max = Math.max(max, this.animations[i].duration);
|
|
52
|
-
}
|
|
53
|
-
return max;
|
|
54
|
-
}
|
|
55
|
-
runAll(methodName) {
|
|
56
|
-
this.animations.forEach((controls) => controls[methodName]());
|
|
57
|
-
}
|
|
58
|
-
play() {
|
|
59
|
-
this.runAll("play");
|
|
60
|
-
}
|
|
61
|
-
pause() {
|
|
62
|
-
this.runAll("pause");
|
|
63
|
-
}
|
|
64
|
-
cancel() {
|
|
65
|
-
this.runAll("cancel");
|
|
66
|
-
}
|
|
67
|
-
complete() {
|
|
68
|
-
this.runAll("complete");
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export { GroupAnimation };
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
import { time } from '../frameloop/sync-time.mjs';
|
|
2
|
-
import { activeAnimations } from '../stats/animation-count.mjs';
|
|
3
|
-
import { mix } from '../utils/mix/index.mjs';
|
|
4
|
-
import { frameloopDriver } from './drivers/frame.mjs';
|
|
5
|
-
import { inertia } from './generators/inertia.mjs';
|
|
6
|
-
import { keyframes } from './generators/keyframes.mjs';
|
|
7
|
-
import { calcGeneratorDuration } from './generators/utils/calc-duration.mjs';
|
|
8
|
-
import { getFinalKeyframe } from './keyframes/get-final.mjs';
|
|
9
|
-
import { replaceTransitionType } from './utils/replace-transition-type.mjs';
|
|
10
|
-
import { WithPromise } from './utils/WithPromise.mjs';
|
|
11
|
-
import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
12
|
-
import { pipe } from '../../../../motion-utils/dist/es/pipe.mjs';
|
|
13
|
-
import { millisecondsToSeconds, secondsToMilliseconds } from '../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
14
|
-
import { clamp } from '../../../../motion-utils/dist/es/clamp.mjs';
|
|
15
|
-
|
|
16
|
-
const percentToProgress = (percent) => percent / 100;
|
|
17
|
-
class JSAnimation extends WithPromise {
|
|
18
|
-
constructor(options) {
|
|
19
|
-
super();
|
|
20
|
-
this.state = "idle";
|
|
21
|
-
this.startTime = null;
|
|
22
|
-
this.isStopped = false;
|
|
23
|
-
/**
|
|
24
|
-
* The current time of the animation.
|
|
25
|
-
*/
|
|
26
|
-
this.currentTime = 0;
|
|
27
|
-
/**
|
|
28
|
-
* The time at which the animation was paused.
|
|
29
|
-
*/
|
|
30
|
-
this.holdTime = null;
|
|
31
|
-
/**
|
|
32
|
-
* Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.
|
|
33
|
-
*/
|
|
34
|
-
this.playbackSpeed = 1;
|
|
35
|
-
/**
|
|
36
|
-
* This method is bound to the instance to fix a pattern where
|
|
37
|
-
* animation.stop is returned as a reference from a useEffect.
|
|
38
|
-
*/
|
|
39
|
-
this.stop = () => {
|
|
40
|
-
const { motionValue } = this.options;
|
|
41
|
-
if (motionValue && motionValue.updatedAt !== time.now()) {
|
|
42
|
-
this.tick(time.now());
|
|
43
|
-
}
|
|
44
|
-
this.isStopped = true;
|
|
45
|
-
if (this.state === "idle")
|
|
46
|
-
return;
|
|
47
|
-
this.teardown();
|
|
48
|
-
this.options.onStop?.();
|
|
49
|
-
};
|
|
50
|
-
activeAnimations.mainThread++;
|
|
51
|
-
this.options = options;
|
|
52
|
-
this.initAnimation();
|
|
53
|
-
this.play();
|
|
54
|
-
if (options.autoplay === false)
|
|
55
|
-
this.pause();
|
|
56
|
-
}
|
|
57
|
-
initAnimation() {
|
|
58
|
-
const { options } = this;
|
|
59
|
-
replaceTransitionType(options);
|
|
60
|
-
const { type = keyframes, repeat = 0, repeatDelay = 0, repeatType, velocity = 0, } = options;
|
|
61
|
-
let { keyframes: keyframes$1 } = options;
|
|
62
|
-
const generatorFactory = type || keyframes;
|
|
63
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
64
|
-
generatorFactory !== keyframes) {
|
|
65
|
-
invariant(keyframes$1.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`);
|
|
66
|
-
}
|
|
67
|
-
if (generatorFactory !== keyframes &&
|
|
68
|
-
typeof keyframes$1[0] !== "number") {
|
|
69
|
-
this.mixKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));
|
|
70
|
-
keyframes$1 = [0, 100];
|
|
71
|
-
}
|
|
72
|
-
const generator = generatorFactory({ ...options, keyframes: keyframes$1 });
|
|
73
|
-
/**
|
|
74
|
-
* If we have a mirror repeat type we need to create a second generator that outputs the
|
|
75
|
-
* mirrored (not reversed) animation and later ping pong between the two generators.
|
|
76
|
-
*/
|
|
77
|
-
if (repeatType === "mirror") {
|
|
78
|
-
this.mirroredGenerator = generatorFactory({
|
|
79
|
-
...options,
|
|
80
|
-
keyframes: [...keyframes$1].reverse(),
|
|
81
|
-
velocity: -velocity,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* If duration is undefined and we have repeat options,
|
|
86
|
-
* we need to calculate a duration from the generator.
|
|
87
|
-
*
|
|
88
|
-
* We set it to the generator itself to cache the duration.
|
|
89
|
-
* Any timeline resolver will need to have already precalculated
|
|
90
|
-
* the duration by this step.
|
|
91
|
-
*/
|
|
92
|
-
if (generator.calculatedDuration === null) {
|
|
93
|
-
generator.calculatedDuration = calcGeneratorDuration(generator);
|
|
94
|
-
}
|
|
95
|
-
const { calculatedDuration } = generator;
|
|
96
|
-
this.calculatedDuration = calculatedDuration;
|
|
97
|
-
this.resolvedDuration = calculatedDuration + repeatDelay;
|
|
98
|
-
this.totalDuration = this.resolvedDuration * (repeat + 1) - repeatDelay;
|
|
99
|
-
this.generator = generator;
|
|
100
|
-
}
|
|
101
|
-
updateTime(timestamp) {
|
|
102
|
-
const animationTime = Math.round(timestamp - this.startTime) * this.playbackSpeed;
|
|
103
|
-
// Update currentTime
|
|
104
|
-
if (this.holdTime !== null) {
|
|
105
|
-
this.currentTime = this.holdTime;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
// Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 =
|
|
109
|
-
// 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for
|
|
110
|
-
// example.
|
|
111
|
-
this.currentTime = animationTime;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
tick(timestamp, sample = false) {
|
|
115
|
-
const { generator, totalDuration, mixKeyframes, mirroredGenerator, resolvedDuration, calculatedDuration, } = this;
|
|
116
|
-
if (this.startTime === null)
|
|
117
|
-
return generator.next(0);
|
|
118
|
-
const { delay = 0, keyframes, repeat, repeatType, repeatDelay, type, onUpdate, finalKeyframe, } = this.options;
|
|
119
|
-
/**
|
|
120
|
-
* requestAnimationFrame timestamps can come through as lower than
|
|
121
|
-
* the startTime as set by performance.now(). Here we prevent this,
|
|
122
|
-
* though in the future it could be possible to make setting startTime
|
|
123
|
-
* a pending operation that gets resolved here.
|
|
124
|
-
*/
|
|
125
|
-
if (this.speed > 0) {
|
|
126
|
-
this.startTime = Math.min(this.startTime, timestamp);
|
|
127
|
-
}
|
|
128
|
-
else if (this.speed < 0) {
|
|
129
|
-
this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime);
|
|
130
|
-
}
|
|
131
|
-
if (sample) {
|
|
132
|
-
this.currentTime = timestamp;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
this.updateTime(timestamp);
|
|
136
|
-
}
|
|
137
|
-
// Rebase on delay
|
|
138
|
-
const timeWithoutDelay = this.currentTime - delay * (this.playbackSpeed >= 0 ? 1 : -1);
|
|
139
|
-
const isInDelayPhase = this.playbackSpeed >= 0
|
|
140
|
-
? timeWithoutDelay < 0
|
|
141
|
-
: timeWithoutDelay > totalDuration;
|
|
142
|
-
this.currentTime = Math.max(timeWithoutDelay, 0);
|
|
143
|
-
// If this animation has finished, set the current time to the total duration.
|
|
144
|
-
if (this.state === "finished" && this.holdTime === null) {
|
|
145
|
-
this.currentTime = totalDuration;
|
|
146
|
-
}
|
|
147
|
-
let elapsed = this.currentTime;
|
|
148
|
-
let frameGenerator = generator;
|
|
149
|
-
if (repeat) {
|
|
150
|
-
/**
|
|
151
|
-
* Get the current progress (0-1) of the animation. If t is >
|
|
152
|
-
* than duration we'll get values like 2.5 (midway through the
|
|
153
|
-
* third iteration)
|
|
154
|
-
*/
|
|
155
|
-
const progress = Math.min(this.currentTime, totalDuration) / resolvedDuration;
|
|
156
|
-
/**
|
|
157
|
-
* Get the current iteration (0 indexed). For instance the floor of
|
|
158
|
-
* 2.5 is 2.
|
|
159
|
-
*/
|
|
160
|
-
let currentIteration = Math.floor(progress);
|
|
161
|
-
/**
|
|
162
|
-
* Get the current progress of the iteration by taking the remainder
|
|
163
|
-
* so 2.5 is 0.5 through iteration 2
|
|
164
|
-
*/
|
|
165
|
-
let iterationProgress = progress % 1.0;
|
|
166
|
-
/**
|
|
167
|
-
* If iteration progress is 1 we count that as the end
|
|
168
|
-
* of the previous iteration.
|
|
169
|
-
*/
|
|
170
|
-
if (!iterationProgress && progress >= 1) {
|
|
171
|
-
iterationProgress = 1;
|
|
172
|
-
}
|
|
173
|
-
iterationProgress === 1 && currentIteration--;
|
|
174
|
-
currentIteration = Math.min(currentIteration, repeat + 1);
|
|
175
|
-
/**
|
|
176
|
-
* Reverse progress if we're not running in "normal" direction
|
|
177
|
-
*/
|
|
178
|
-
const isOddIteration = Boolean(currentIteration % 2);
|
|
179
|
-
if (isOddIteration) {
|
|
180
|
-
if (repeatType === "reverse") {
|
|
181
|
-
iterationProgress = 1 - iterationProgress;
|
|
182
|
-
if (repeatDelay) {
|
|
183
|
-
iterationProgress -= repeatDelay / resolvedDuration;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
else if (repeatType === "mirror") {
|
|
187
|
-
frameGenerator = mirroredGenerator;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* If we're in negative time, set state as the initial keyframe.
|
|
194
|
-
* This prevents delay: x, duration: 0 animations from finishing
|
|
195
|
-
* instantly.
|
|
196
|
-
*/
|
|
197
|
-
const state = isInDelayPhase
|
|
198
|
-
? { done: false, value: keyframes[0] }
|
|
199
|
-
: frameGenerator.next(elapsed);
|
|
200
|
-
if (mixKeyframes) {
|
|
201
|
-
state.value = mixKeyframes(state.value);
|
|
202
|
-
}
|
|
203
|
-
let { done } = state;
|
|
204
|
-
if (!isInDelayPhase && calculatedDuration !== null) {
|
|
205
|
-
done =
|
|
206
|
-
this.playbackSpeed >= 0
|
|
207
|
-
? this.currentTime >= totalDuration
|
|
208
|
-
: this.currentTime <= 0;
|
|
209
|
-
}
|
|
210
|
-
const isAnimationFinished = this.holdTime === null &&
|
|
211
|
-
(this.state === "finished" || (this.state === "running" && done));
|
|
212
|
-
// TODO: The exception for inertia could be cleaner here
|
|
213
|
-
if (isAnimationFinished && type !== inertia) {
|
|
214
|
-
state.value = getFinalKeyframe(keyframes, this.options, finalKeyframe, this.speed);
|
|
215
|
-
}
|
|
216
|
-
if (onUpdate) {
|
|
217
|
-
onUpdate(state.value);
|
|
218
|
-
}
|
|
219
|
-
if (isAnimationFinished) {
|
|
220
|
-
this.finish();
|
|
221
|
-
}
|
|
222
|
-
return state;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
226
|
-
* resolves when the animation finishes at all but in a future update could/should
|
|
227
|
-
* reject if its cancels.
|
|
228
|
-
*/
|
|
229
|
-
then(resolve, reject) {
|
|
230
|
-
return this.finished.then(resolve, reject);
|
|
231
|
-
}
|
|
232
|
-
get duration() {
|
|
233
|
-
return millisecondsToSeconds(this.calculatedDuration);
|
|
234
|
-
}
|
|
235
|
-
get time() {
|
|
236
|
-
return millisecondsToSeconds(this.currentTime);
|
|
237
|
-
}
|
|
238
|
-
set time(newTime) {
|
|
239
|
-
newTime = secondsToMilliseconds(newTime);
|
|
240
|
-
this.currentTime = newTime;
|
|
241
|
-
if (this.startTime === null ||
|
|
242
|
-
this.holdTime !== null ||
|
|
243
|
-
this.playbackSpeed === 0) {
|
|
244
|
-
this.holdTime = newTime;
|
|
245
|
-
}
|
|
246
|
-
else if (this.driver) {
|
|
247
|
-
this.startTime = this.driver.now() - newTime / this.playbackSpeed;
|
|
248
|
-
}
|
|
249
|
-
this.driver?.start(false);
|
|
250
|
-
}
|
|
251
|
-
get speed() {
|
|
252
|
-
return this.playbackSpeed;
|
|
253
|
-
}
|
|
254
|
-
set speed(newSpeed) {
|
|
255
|
-
this.updateTime(time.now());
|
|
256
|
-
const hasChanged = this.playbackSpeed !== newSpeed;
|
|
257
|
-
this.playbackSpeed = newSpeed;
|
|
258
|
-
if (hasChanged) {
|
|
259
|
-
this.time = millisecondsToSeconds(this.currentTime);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
play() {
|
|
263
|
-
if (this.isStopped)
|
|
264
|
-
return;
|
|
265
|
-
const { driver = frameloopDriver, startTime } = this.options;
|
|
266
|
-
if (!this.driver) {
|
|
267
|
-
this.driver = driver((timestamp) => this.tick(timestamp));
|
|
268
|
-
}
|
|
269
|
-
this.options.onPlay?.();
|
|
270
|
-
const now = this.driver.now();
|
|
271
|
-
if (this.state === "finished") {
|
|
272
|
-
this.updateFinished();
|
|
273
|
-
this.startTime = now;
|
|
274
|
-
}
|
|
275
|
-
else if (this.holdTime !== null) {
|
|
276
|
-
this.startTime = now - this.holdTime;
|
|
277
|
-
}
|
|
278
|
-
else if (!this.startTime) {
|
|
279
|
-
this.startTime = startTime ?? now;
|
|
280
|
-
}
|
|
281
|
-
if (this.state === "finished" && this.speed < 0) {
|
|
282
|
-
this.startTime += this.calculatedDuration;
|
|
283
|
-
}
|
|
284
|
-
this.holdTime = null;
|
|
285
|
-
/**
|
|
286
|
-
* Set playState to running only after we've used it in
|
|
287
|
-
* the previous logic.
|
|
288
|
-
*/
|
|
289
|
-
this.state = "running";
|
|
290
|
-
this.driver.start();
|
|
291
|
-
}
|
|
292
|
-
pause() {
|
|
293
|
-
this.state = "paused";
|
|
294
|
-
this.updateTime(time.now());
|
|
295
|
-
this.holdTime = this.currentTime;
|
|
296
|
-
}
|
|
297
|
-
complete() {
|
|
298
|
-
if (this.state !== "running") {
|
|
299
|
-
this.play();
|
|
300
|
-
}
|
|
301
|
-
this.state = "finished";
|
|
302
|
-
this.holdTime = null;
|
|
303
|
-
}
|
|
304
|
-
finish() {
|
|
305
|
-
this.notifyFinished();
|
|
306
|
-
this.teardown();
|
|
307
|
-
this.state = "finished";
|
|
308
|
-
this.options.onComplete?.();
|
|
309
|
-
}
|
|
310
|
-
cancel() {
|
|
311
|
-
this.holdTime = null;
|
|
312
|
-
this.startTime = 0;
|
|
313
|
-
this.tick(0);
|
|
314
|
-
this.teardown();
|
|
315
|
-
this.options.onCancel?.();
|
|
316
|
-
}
|
|
317
|
-
teardown() {
|
|
318
|
-
this.state = "idle";
|
|
319
|
-
this.stopDriver();
|
|
320
|
-
this.startTime = this.holdTime = null;
|
|
321
|
-
activeAnimations.mainThread--;
|
|
322
|
-
}
|
|
323
|
-
stopDriver() {
|
|
324
|
-
if (!this.driver)
|
|
325
|
-
return;
|
|
326
|
-
this.driver.stop();
|
|
327
|
-
this.driver = undefined;
|
|
328
|
-
}
|
|
329
|
-
sample(sampleTime) {
|
|
330
|
-
this.startTime = 0;
|
|
331
|
-
return this.tick(sampleTime, true);
|
|
332
|
-
}
|
|
333
|
-
attachTimeline(timeline) {
|
|
334
|
-
if (this.options.allowFlatten) {
|
|
335
|
-
this.options.type = "keyframes";
|
|
336
|
-
this.options.ease = "linear";
|
|
337
|
-
this.initAnimation();
|
|
338
|
-
}
|
|
339
|
-
this.driver?.stop();
|
|
340
|
-
return timeline.observe(this);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
// Legacy function support
|
|
344
|
-
function animateValue(options) {
|
|
345
|
-
return new JSAnimation(options);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export { JSAnimation, animateValue };
|