motion-v 1.0.0-alpha.4 → 1.0.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/cjs/index.js +1063 -265
- package/dist/es/components/animate-presence/AnimatePresence.d.ts +1 -1
- package/dist/es/components/animate-presence/use-pop-layout.mjs +2 -1
- package/dist/es/components/motion/props.d.ts +0 -6
- package/dist/es/components/motion/props.mjs +1 -3
- package/dist/es/components/motion/use-motion-state.d.ts +41 -41
- package/dist/es/components/motion/use-motion-state.mjs +5 -3
- package/dist/es/components/motion/utils.mjs +4 -2
- package/dist/es/components/reorder/index.d.ts +160 -160
- package/dist/es/components/reorder/utils.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animate/index.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animate/single-value.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +4 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +2 -3
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +3 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +1 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +4 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/animators/waapi/index.mjs +2 -9
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/generators/spring/index.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/interfaces/motion-value.mjs +3 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +3 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/animation/sequence/create.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/easing/utils/map.mjs +1 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/projection/node/create-projection-node.mjs +4 -24
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/VisualElement.mjs +3 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/resize/handle-element.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/scroll/index.mjs +1 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/scroll/observe.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/scroll/track.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/dom/viewport/index.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/render/utils/setters.mjs +2 -1
- package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/utils/delay.mjs +2 -1
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/controls/BaseGroup.mjs +79 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/controls/Group.mjs +9 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs +15 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs +17 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/utils/get-value-transition.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs +81 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/attach-timeline.mjs +7 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/easing.mjs +37 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/linear.mjs +13 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/batcher.mjs +64 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs +10 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/microtask.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/order.mjs +17 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/render-step.mjs +70 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/sync-time.mjs +22 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/drag/state/is-active.mjs +11 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/hover.mjs +30 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/press/index.mjs +74 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.mjs +13 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/press/utils/keyboard.mjs +32 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/press/utils/state.mjs +4 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/utils/capture-pointer.mjs +12 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/utils/is-node-or-child.mjs +12 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs +10 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/gestures/utils/setup.mjs +15 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/stats/buffer.mjs +7 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/is-bezier-definition.mjs +4 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/resolve-elements.mjs +17 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/flags.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/linear-easing.mjs +12 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/memo.mjs +13 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/scroll-timeline.mjs +6 -0
- package/dist/es/external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/value/index.mjs +277 -0
- package/dist/es/external/.pnpm/motion-utils@12.5.0/external/motion-utils/dist/es/global-config.mjs +7 -0
- package/dist/es/features/gestures/drag/VisualElementDragControls.mjs +2 -1
- package/dist/es/features/gestures/hover/index.mjs +3 -1
- package/dist/es/features/gestures/in-view/index.mjs +2 -1
- package/dist/es/features/gestures/pan/PanSession.mjs +2 -1
- package/dist/es/features/gestures/pan/index.mjs +1 -1
- package/dist/es/features/gestures/press/index.mjs +3 -1
- package/dist/es/index.mjs +6 -1
- package/dist/es/state/create-visual-element.d.ts +2 -1
- package/dist/es/state/motion-state.mjs +1 -1
- package/dist/es/state/style.mjs +4 -0
- package/dist/es/state/utils.d.ts +2 -4
- package/dist/es/types/common.d.ts +1 -1
- package/dist/es/utils/use-animation-frame.mjs +2 -1
- package/dist/es/value/use-combine-values.mjs +3 -1
- package/dist/es/value/use-computed.mjs +2 -1
- package/dist/es/value/use-scroll.mjs +2 -1
- package/dist/es/value/use-spring.mjs +3 -1
- package/dist/es/value/use-time.mjs +2 -1
- package/dist/es/value/use-velocity.mjs +3 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mixNumber } from "../../utils/mix/number.mjs";
|
|
2
|
+
import { motionValue } from "../../external/.pnpm/motion-dom@12.5.0/external/motion-dom/dist/es/value/index.mjs";
|
|
3
|
+
import "../../external/.pnpm/motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
4
|
import { isMotionValue } from "../../utils/motion-value.mjs";
|
|
3
|
-
import { motionValue } from "motion-dom";
|
|
4
5
|
function compareMin(a, b) {
|
|
5
6
|
return a.layout.min - b.layout.min;
|
|
6
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GroupPlaybackControls } from "motion-dom";
|
|
1
|
+
import { GroupPlaybackControls } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/controls/Group.mjs";
|
|
2
|
+
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
3
|
import { animateSequence } from "./sequence.mjs";
|
|
3
4
|
import { animateSubject } from "./subject.mjs";
|
|
4
5
|
function isSequence(value) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { resolveElements } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/utils/resolve-elements.mjs";
|
|
2
3
|
import { isDOMKeyframes } from "../utils/is-dom-keyframes.mjs";
|
|
3
4
|
function resolveSubjects(subject, keyframes, scope, selectorCache) {
|
|
4
5
|
if (typeof subject === "string" && isDOMKeyframes(keyframes)) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { motionValue } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/value/index.mjs";
|
|
2
3
|
import { isMotionValue } from "../../value/utils/is-motion-value.mjs";
|
|
3
4
|
import { animateMotionValue } from "../interfaces/motion-value.mjs";
|
|
4
5
|
function animateSingleValue(value, keyframes, options) {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { supportsLinearEasing, attachTimeline, isGenerator, isWaapiSupportedEasing } from "motion-dom";
|
|
2
1
|
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { noop } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/noop.mjs";
|
|
4
3
|
import { millisecondsToSeconds, secondsToMilliseconds } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/time-conversion.mjs";
|
|
4
|
+
import { isGenerator } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/is-generator.mjs";
|
|
5
|
+
import { attachTimeline } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/attach-timeline.mjs";
|
|
6
|
+
import { isWaapiSupportedEasing } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/easing.mjs";
|
|
7
|
+
import { supportsLinearEasing } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/linear-easing.mjs";
|
|
5
8
|
import { anticipate } from "../../easing/anticipate.mjs";
|
|
6
9
|
import { backInOut } from "../../easing/back.mjs";
|
|
7
10
|
import { circInOut } from "../../easing/circ.mjs";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { time } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/sync-time.mjs";
|
|
2
3
|
import { flushKeyframeResolvers } from "../../render/utils/KeyframesResolver.mjs";
|
|
3
4
|
import { canAnimate } from "./utils/can-animate.mjs";
|
|
4
5
|
import { getFinalKeyframe } from "./waapi/utils/get-final-keyframe.mjs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { isGenerator, calcGeneratorDuration, activeAnimations } from "motion-dom";
|
|
2
1
|
import { invariant } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { millisecondsToSeconds, secondsToMilliseconds } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/time-conversion.mjs";
|
|
3
|
+
import { calcGeneratorDuration } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs";
|
|
4
|
+
import { isGenerator } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/is-generator.mjs";
|
|
4
5
|
import { KeyframeResolver } from "../../render/utils/KeyframesResolver.mjs";
|
|
5
6
|
import { clamp } from "../../utils/clamp.mjs";
|
|
6
7
|
import { mix } from "../../utils/mix/index.mjs";
|
|
@@ -87,7 +88,6 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
87
88
|
}
|
|
88
89
|
onPostResolved() {
|
|
89
90
|
const { autoplay = true } = this.options;
|
|
90
|
-
activeAnimations.mainThread++;
|
|
91
91
|
this.play();
|
|
92
92
|
if (this.pendingPlayState === "paused" || !autoplay) {
|
|
93
93
|
this.pause();
|
|
@@ -260,7 +260,6 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
260
260
|
this.updateFinishedPromise();
|
|
261
261
|
this.startTime = this.cancelTime = null;
|
|
262
262
|
this.resolver.cancel();
|
|
263
|
-
activeAnimations.mainThread--;
|
|
264
263
|
}
|
|
265
264
|
stopDriver() {
|
|
266
265
|
if (!this.driver)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { frame, cancelFrame, frameData } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
3
|
+
import { time } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/sync-time.mjs";
|
|
2
4
|
const frameloopDriver = (update) => {
|
|
3
5
|
const passTimestamp = ({ timestamp }) => update(timestamp);
|
|
4
6
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isGenerator } from "motion-dom";
|
|
2
1
|
import { warning } from "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { isGenerator } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/is-generator.mjs";
|
|
3
3
|
import { isAnimatable } from "../../utils/is-animatable.mjs";
|
|
4
4
|
function hasKeyframesChanged(keyframes) {
|
|
5
5
|
const current = keyframes[0];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { NativeAnimationControls, isGenerator, createGeneratorEasing, supportsLinearEasing } from "motion-dom";
|
|
2
1
|
import { invariant } from "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { secondsToMilliseconds } from "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/time-conversion.mjs";
|
|
3
|
+
import { createGeneratorEasing } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs";
|
|
4
|
+
import { isGenerator } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/is-generator.mjs";
|
|
5
|
+
import { NativeAnimationControls } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs";
|
|
6
|
+
import { supportsLinearEasing } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/linear-easing.mjs";
|
|
4
7
|
import { startWaapiAnimation } from "./index.mjs";
|
|
5
8
|
import { browserNumberValueTypes } from "../../../render/dom/value-types/number-browser.mjs";
|
|
6
9
|
import { getFinalKeyframe } from "./utils/get-final-keyframe.mjs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { resolveElements, getValueTransition } from "motion-dom";
|
|
2
1
|
import { invariant } from "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { secondsToMilliseconds } from "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/time-conversion.mjs";
|
|
3
|
+
import { getValueTransition } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/utils/get-value-transition.mjs";
|
|
4
|
+
import { resolveElements } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/utils/resolve-elements.mjs";
|
|
4
5
|
import { NativeAnimation } from "./NativeAnimation.mjs";
|
|
5
6
|
function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
6
7
|
const elements = resolveElements(elementOrSelector, scope);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GroupPlaybackControls } from "motion-dom";
|
|
1
|
+
import { GroupPlaybackControls } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/controls/Group.mjs";
|
|
2
|
+
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
3
|
import { animateElements } from "./animate-elements.mjs";
|
|
3
4
|
const createScopedWaapiAnimate = (scope) => {
|
|
4
5
|
function scopedAnimate(elementOrSelector, keyframes, options) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { mapEasingToNativeEasing } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/easing.mjs";
|
|
2
3
|
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times } = {}) {
|
|
3
4
|
const keyframeOptions = { [valueName]: keyframes };
|
|
4
5
|
if (times)
|
|
@@ -6,9 +7,6 @@ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duratio
|
|
|
6
7
|
const easing = mapEasingToNativeEasing(ease, duration);
|
|
7
8
|
if (Array.isArray(easing))
|
|
8
9
|
keyframeOptions.easing = easing;
|
|
9
|
-
if (statsBuffer.value) {
|
|
10
|
-
activeAnimations.waapi++;
|
|
11
|
-
}
|
|
12
10
|
const animation = element.animate(keyframeOptions, {
|
|
13
11
|
delay,
|
|
14
12
|
duration,
|
|
@@ -17,11 +15,6 @@ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duratio
|
|
|
17
15
|
iterations: repeat + 1,
|
|
18
16
|
direction: repeatType === "reverse" ? "alternate" : "normal"
|
|
19
17
|
});
|
|
20
|
-
if (statsBuffer.value) {
|
|
21
|
-
animation.finished.finally(() => {
|
|
22
|
-
activeAnimations.waapi--;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
18
|
return animation;
|
|
26
19
|
}
|
|
27
20
|
export {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { calcGeneratorDuration, maxGeneratorDuration, generateLinearEasing } from "motion-dom";
|
|
2
1
|
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { millisecondsToSeconds, secondsToMilliseconds } from "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/time-conversion.mjs";
|
|
3
|
+
import { calcGeneratorDuration, maxGeneratorDuration } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs";
|
|
4
|
+
import { generateLinearEasing } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/waapi/utils/linear.mjs";
|
|
4
5
|
import { clamp } from "../../../utils/clamp.mjs";
|
|
5
6
|
import { calcGeneratorVelocity } from "../utils/velocity.mjs";
|
|
6
7
|
import { springDefaults } from "./defaults.mjs";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GroupPlaybackControls } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/controls/Group.mjs";
|
|
2
|
+
import { getValueTransition } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/utils/get-value-transition.mjs";
|
|
2
3
|
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
4
|
import { secondsToMilliseconds } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/time-conversion.mjs";
|
|
5
|
+
import { frame } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
4
6
|
import { AcceleratedAnimation } from "../animators/AcceleratedAnimation.mjs";
|
|
5
7
|
import { MainThreadAnimation } from "../animators/MainThreadAnimation.mjs";
|
|
6
8
|
import { getFinalKeyframe } from "../animators/waapi/utils/get-final-keyframe.mjs";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { getValueTransition } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/utils/get-value-transition.mjs";
|
|
3
|
+
import { frame } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
2
4
|
import { positionalKeys } from "../../render/html/utils/keys-position.mjs";
|
|
3
5
|
import { setTarget } from "../../render/utils/setters.mjs";
|
|
4
6
|
import { addValueToWillChange } from "../../value/use-will-change/add-will-change.mjs";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { isGenerator, createGeneratorEasing } from "motion-dom";
|
|
2
1
|
import { invariant } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { progress } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/progress.mjs";
|
|
4
3
|
import { secondsToMilliseconds } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/time-conversion.mjs";
|
|
4
|
+
import { createGeneratorEasing } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs";
|
|
5
|
+
import { isGenerator } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/generators/utils/is-generator.mjs";
|
|
5
6
|
import { getEasingForSegment } from "../../easing/utils/get-easing-for-segment.mjs";
|
|
6
7
|
import { defaultOffset } from "../../utils/offsets/default.mjs";
|
|
7
8
|
import { fillOffset } from "../../utils/offsets/fill.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isBezierDefinition } from "motion-dom";
|
|
2
1
|
import { invariant } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { noop } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/noop.mjs";
|
|
3
|
+
import { isBezierDefinition } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/utils/is-bezier-definition.mjs";
|
|
4
4
|
import { anticipate } from "../anticipate.mjs";
|
|
5
5
|
import { backIn, backInOut, backOut } from "../back.mjs";
|
|
6
6
|
import { circIn, circInOut, circOut } from "../circ.mjs";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { statsBuffer, getValueTransition, cancelFrame, time, frameData, frameSteps, microtask, frame, activeAnimations } from "motion-dom";
|
|
2
1
|
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { noop } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/noop.mjs";
|
|
4
3
|
import { SubscriptionManager } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/subscription-manager.mjs";
|
|
4
|
+
import { getValueTransition } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/animation/utils/get-value-transition.mjs";
|
|
5
|
+
import { cancelFrame, frameData, frameSteps, frame } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
6
|
+
import { microtask } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/microtask.mjs";
|
|
7
|
+
import { time } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/sync-time.mjs";
|
|
5
8
|
import { animateSingleValue } from "../../animation/animate/single-value.mjs";
|
|
6
9
|
import { getOptimisedAppearId } from "../../animation/optimized-appear/get-appear-id.mjs";
|
|
7
10
|
import { isSVGElement } from "../../render/dom/utils/is-svg-element.mjs";
|
|
@@ -23,11 +26,6 @@ import { buildProjectionTransform } from "../styles/transform.mjs";
|
|
|
23
26
|
import { eachAxis } from "../utils/each-axis.mjs";
|
|
24
27
|
import { hasTransform, hasScale, has2DTranslate } from "../utils/has-transform.mjs";
|
|
25
28
|
import { globalProjectionState } from "./state.mjs";
|
|
26
|
-
const metrics = {
|
|
27
|
-
nodes: 0,
|
|
28
|
-
calculatedTargetDeltas: 0,
|
|
29
|
-
calculatedProjections: 0
|
|
30
|
-
};
|
|
31
29
|
const transformAxes = ["", "X", "Y", "Z"];
|
|
32
30
|
const hiddenVisibility = { visibility: "hidden" };
|
|
33
31
|
const animationTarget = 1e3;
|
|
@@ -93,16 +91,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
93
91
|
};
|
|
94
92
|
this.updateProjection = () => {
|
|
95
93
|
this.projectionUpdateScheduled = false;
|
|
96
|
-
if (statsBuffer.value) {
|
|
97
|
-
metrics.nodes = metrics.calculatedTargetDeltas = metrics.calculatedProjections = 0;
|
|
98
|
-
}
|
|
99
94
|
this.nodes.forEach(propagateDirtyNodes);
|
|
100
95
|
this.nodes.forEach(resolveTargetDelta);
|
|
101
96
|
this.nodes.forEach(calcProjection);
|
|
102
97
|
this.nodes.forEach(cleanDirtyNodes);
|
|
103
|
-
if (statsBuffer.addProjectionMetrics) {
|
|
104
|
-
statsBuffer.addProjectionMetrics(metrics);
|
|
105
|
-
}
|
|
106
98
|
};
|
|
107
99
|
this.resolvedRelativeTargetAt = 0;
|
|
108
100
|
this.hasProjected = false;
|
|
@@ -561,9 +553,6 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
561
553
|
this.relativeParent = this.relativeTarget = void 0;
|
|
562
554
|
}
|
|
563
555
|
}
|
|
564
|
-
if (statsBuffer.value) {
|
|
565
|
-
metrics.calculatedTargetDeltas++;
|
|
566
|
-
}
|
|
567
556
|
}
|
|
568
557
|
getClosestProjectingParent() {
|
|
569
558
|
if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) {
|
|
@@ -629,9 +618,6 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
629
618
|
this.scheduleRender();
|
|
630
619
|
this.notifyListeners("projectionUpdate", target);
|
|
631
620
|
}
|
|
632
|
-
if (statsBuffer.value) {
|
|
633
|
-
metrics.calculatedProjections++;
|
|
634
|
-
}
|
|
635
621
|
}
|
|
636
622
|
hide() {
|
|
637
623
|
this.isVisible = false;
|
|
@@ -710,7 +696,6 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
710
696
|
}
|
|
711
697
|
this.pendingAnimation = frame.update(() => {
|
|
712
698
|
globalProjectionState.hasAnimatedSinceResize = true;
|
|
713
|
-
activeAnimations.layout++;
|
|
714
699
|
this.currentAnimation = animateSingleValue(0, animationTarget, {
|
|
715
700
|
...options,
|
|
716
701
|
onUpdate: (latest) => {
|
|
@@ -718,10 +703,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
718
703
|
options.onUpdate && options.onUpdate(latest);
|
|
719
704
|
},
|
|
720
705
|
onStop: () => {
|
|
721
|
-
activeAnimations.layout--;
|
|
722
706
|
},
|
|
723
707
|
onComplete: () => {
|
|
724
|
-
activeAnimations.layout--;
|
|
725
708
|
options.onComplete && options.onComplete();
|
|
726
709
|
this.completeAnimation();
|
|
727
710
|
}
|
|
@@ -999,9 +982,6 @@ function notifyLayoutUpdate(node) {
|
|
|
999
982
|
node.options.transition = void 0;
|
|
1000
983
|
}
|
|
1001
984
|
function propagateDirtyNodes(node) {
|
|
1002
|
-
if (statsBuffer.value) {
|
|
1003
|
-
metrics.nodes++;
|
|
1004
|
-
}
|
|
1005
985
|
if (!node.parent)
|
|
1006
986
|
return;
|
|
1007
987
|
if (!node.isProjecting()) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { time, frame, cancelFrame, motionValue } from "motion-dom";
|
|
2
1
|
import "../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { SubscriptionManager } from "../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/subscription-manager.mjs";
|
|
4
3
|
import { warnOnce } from "../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/warn-once.mjs";
|
|
4
|
+
import { frame, cancelFrame } from "../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
5
|
+
import { time } from "../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/sync-time.mjs";
|
|
6
|
+
import { motionValue } from "../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/value/index.mjs";
|
|
5
7
|
import { featureDefinitions } from "../motion/features/definitions.mjs";
|
|
6
8
|
import { createBox } from "../projection/geometry/models.mjs";
|
|
7
9
|
import { isNumericalString } from "../utils/is-numerical-string.mjs";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { resolveElements } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/utils/resolve-elements.mjs";
|
|
2
3
|
const resizeHandlers = /* @__PURE__ */ new WeakMap();
|
|
3
4
|
let observer;
|
|
4
5
|
function getElementSize(target, borderBoxSize) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { supportsScrollTimeline } from "motion-dom";
|
|
1
|
+
import { supportsScrollTimeline } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/utils/supports/scroll-timeline.mjs";
|
|
2
2
|
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
3
|
import { noop } from "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/noop.mjs";
|
|
4
4
|
import { observeTimeline } from "./observe.mjs";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { frame, cancelFrame } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
2
3
|
function observeTimeline(update, timeline) {
|
|
3
4
|
let prevProgress;
|
|
4
5
|
const onFrame = () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { frame, cancelFrame, frameData } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
2
3
|
import { resize } from "../resize/index.mjs";
|
|
3
4
|
import { createScrollInfo } from "./info.mjs";
|
|
4
5
|
import { createOnScrollHandler } from "./on-scroll-handler.mjs";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { resolveElements } from "../../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/utils/resolve-elements.mjs";
|
|
2
3
|
const thresholds = {
|
|
3
4
|
some: 0,
|
|
4
5
|
all: 1
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { frame } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
2
3
|
import { createBox } from "../../projection/geometry/models.mjs";
|
|
3
4
|
import { DOMVisualElement } from "../dom/DOMVisualElement.mjs";
|
|
4
5
|
import { camelToDash } from "../dom/utils/camel-to-dash.mjs";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { frame } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
2
3
|
import { removeNonTranslationalTransform } from "../dom/utils/unit-conversion.mjs";
|
|
3
4
|
const toResolve = /* @__PURE__ */ new Set();
|
|
4
5
|
let isScheduled = false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { motionValue } from "motion-dom";
|
|
2
1
|
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { warnOnce } from "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/warn-once.mjs";
|
|
3
|
+
import { motionValue } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/value/index.mjs";
|
|
4
4
|
import { isMotionValue } from "../../value/utils/is-motion-value.mjs";
|
|
5
5
|
function updateMotionValuesFromProps(element, next, prev) {
|
|
6
6
|
for (const key in next) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { motionValue } from "../../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/value/index.mjs";
|
|
2
3
|
import { resolveFinalValueInKeyframes } from "../../utils/resolve-value.mjs";
|
|
3
4
|
import { resolveVariant } from "./resolve-dynamic-variants.mjs";
|
|
4
5
|
function setMotionValue(visualElement, key, value) {
|
package/dist/es/external/.pnpm/framer-motion@12.5.0/external/framer-motion/dist/es/utils/delay.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { time, frame, cancelFrame } from "motion-dom";
|
|
2
1
|
import "../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
3
2
|
import { secondsToMilliseconds } from "../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/time-conversion.mjs";
|
|
3
|
+
import { frame, cancelFrame } from "../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/frame.mjs";
|
|
4
|
+
import { time } from "../../../../../../motion-dom@12.5.0/external/motion-dom/dist/es/frameloop/sync-time.mjs";
|
|
4
5
|
function delay(callback, timeout) {
|
|
5
6
|
const start = time.now();
|
|
6
7
|
const checkElapsed = ({ timestamp }) => {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { supportsScrollTimeline } from "../../utils/supports/scroll-timeline.mjs";
|
|
2
|
+
class BaseGroupPlaybackControls {
|
|
3
|
+
constructor(animations) {
|
|
4
|
+
this.stop = () => this.runAll("stop");
|
|
5
|
+
this.animations = animations.filter(Boolean);
|
|
6
|
+
}
|
|
7
|
+
get finished() {
|
|
8
|
+
return Promise.all(this.animations.map((animation) => "finished" in animation ? animation.finished : animation));
|
|
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, fallback) {
|
|
22
|
+
const subscriptions = this.animations.map((animation) => {
|
|
23
|
+
if (supportsScrollTimeline() && animation.attachTimeline) {
|
|
24
|
+
return animation.attachTimeline(timeline);
|
|
25
|
+
} else if (typeof fallback === "function") {
|
|
26
|
+
return fallback(animation);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return () => {
|
|
30
|
+
subscriptions.forEach((cancel, i) => {
|
|
31
|
+
cancel && cancel();
|
|
32
|
+
this.animations[i].stop();
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
get time() {
|
|
37
|
+
return this.getAll("time");
|
|
38
|
+
}
|
|
39
|
+
set time(time) {
|
|
40
|
+
this.setAll("time", time);
|
|
41
|
+
}
|
|
42
|
+
get speed() {
|
|
43
|
+
return this.getAll("speed");
|
|
44
|
+
}
|
|
45
|
+
set speed(speed) {
|
|
46
|
+
this.setAll("speed", speed);
|
|
47
|
+
}
|
|
48
|
+
get startTime() {
|
|
49
|
+
return this.getAll("startTime");
|
|
50
|
+
}
|
|
51
|
+
get duration() {
|
|
52
|
+
let max = 0;
|
|
53
|
+
for (let i = 0; i < this.animations.length; i++) {
|
|
54
|
+
max = Math.max(max, this.animations[i].duration);
|
|
55
|
+
}
|
|
56
|
+
return max;
|
|
57
|
+
}
|
|
58
|
+
runAll(methodName) {
|
|
59
|
+
this.animations.forEach((controls) => controls[methodName]());
|
|
60
|
+
}
|
|
61
|
+
flatten() {
|
|
62
|
+
this.runAll("flatten");
|
|
63
|
+
}
|
|
64
|
+
play() {
|
|
65
|
+
this.runAll("play");
|
|
66
|
+
}
|
|
67
|
+
pause() {
|
|
68
|
+
this.runAll("pause");
|
|
69
|
+
}
|
|
70
|
+
cancel() {
|
|
71
|
+
this.runAll("cancel");
|
|
72
|
+
}
|
|
73
|
+
complete() {
|
|
74
|
+
this.runAll("complete");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
BaseGroupPlaybackControls
|
|
79
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseGroupPlaybackControls } from "./BaseGroup.mjs";
|
|
2
|
+
class GroupPlaybackControls extends BaseGroupPlaybackControls {
|
|
3
|
+
then(onResolve, onReject) {
|
|
4
|
+
return Promise.all(this.animations).then(onResolve).catch(onReject);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
GroupPlaybackControls
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const maxGeneratorDuration = 2e4;
|
|
2
|
+
function calcGeneratorDuration(generator) {
|
|
3
|
+
let duration = 0;
|
|
4
|
+
const timeStep = 50;
|
|
5
|
+
let state = generator.next(duration);
|
|
6
|
+
while (!state.done && duration < maxGeneratorDuration) {
|
|
7
|
+
duration += timeStep;
|
|
8
|
+
state = generator.next(duration);
|
|
9
|
+
}
|
|
10
|
+
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
calcGeneratorDuration,
|
|
14
|
+
maxGeneratorDuration
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/errors.mjs";
|
|
2
|
+
import { millisecondsToSeconds } from "../../../../../../../../motion-utils@12.5.0/external/motion-utils/dist/es/time-conversion.mjs";
|
|
3
|
+
import { calcGeneratorDuration, maxGeneratorDuration } from "./calc-duration.mjs";
|
|
4
|
+
function createGeneratorEasing(options, scale = 100, createGenerator) {
|
|
5
|
+
const generator = createGenerator({ ...options, keyframes: [0, scale] });
|
|
6
|
+
const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
7
|
+
return {
|
|
8
|
+
type: "keyframes",
|
|
9
|
+
ease: (progress) => {
|
|
10
|
+
return generator.next(duration * progress).value / scale;
|
|
11
|
+
},
|
|
12
|
+
duration: millisecondsToSeconds(duration)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
createGeneratorEasing
|
|
17
|
+
};
|