motion 11.14.4 → 11.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -19
- package/dist/cjs/index.js +1795 -1724
- package/dist/cjs/mini.js +215 -185
- package/dist/cjs/react-client.js +3713 -3699
- package/dist/cjs/react-m.js +3 -2
- package/dist/cjs/react-mini.js +215 -185
- package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +1 -0
- package/dist/es/framer-motion/dist/es/animation/animate/single-value.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +7 -7
- package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +8 -8
- package/dist/es/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +26 -89
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +3 -3
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/index.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +2 -1
- package/dist/es/framer-motion/dist/es/animation/generators/spring/find.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +9 -6
- package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +7 -6
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +4 -3
- package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +32 -6
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-repeat-duration.mjs +5 -0
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/normalize-times.mjs +13 -0
- package/dist/es/framer-motion/dist/es/easing/utils/map.mjs +4 -4
- package/dist/es/framer-motion/dist/es/events/event-info.mjs +1 -0
- package/dist/es/framer-motion/dist/es/frameloop/render-step.mjs +3 -2
- package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +2 -1
- package/dist/es/framer-motion/dist/es/gestures/hover.mjs +1 -0
- package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +5 -4
- package/dist/es/framer-motion/dist/es/gestures/press.mjs +1 -0
- package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +3 -3
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +15 -15
- package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +1 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +3 -3
- package/dist/es/framer-motion/dist/es/render/dom/scroll/info.mjs +2 -1
- package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +1 -0
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/utils/delay.mjs +2 -1
- package/dist/es/framer-motion/dist/es/utils/interpolate.mjs +3 -3
- package/dist/es/framer-motion/dist/es/utils/offsets/fill.mjs +2 -1
- package/dist/es/framer-motion/dist/es/value/index.mjs +2 -2
- package/dist/es/framer-motion/dist/es/value/use-spring.mjs +3 -3
- package/dist/es/motion/lib/index.mjs +8 -8
- package/dist/es/motion/lib/react.mjs +8 -8
- package/dist/es/{framer-motion/dist/es/animation/GroupPlaybackControls.mjs → motion-dom/dist/es/animation/controls/BaseGroup.mjs} +6 -5
- package/dist/es/motion-dom/dist/es/animation/controls/Group.mjs +13 -0
- package/dist/es/{framer-motion/dist/es/easing → motion-dom/dist/es/animation/generators}/utils/create-generator-easing.mjs +6 -3
- package/dist/es/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs +85 -0
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi → motion-dom/dist/es/animation/waapi/utils}/easing.mjs +3 -3
- package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/waapi/utils/linear.mjs +2 -1
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/supports-linear-easing.mjs → motion-dom/dist/es/utils/supports/linear-easing.mjs} +1 -1
- package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/memo-supports.mjs → motion-dom/dist/es/utils/supports/memo.mjs} +3 -2
- package/dist/es/motion-dom/dist/es/utils/supports/scroll-timeline.mjs +6 -0
- package/dist/motion.dev.js +1795 -1724
- package/dist/motion.js +1 -1
- package/package.json +3 -3
- package/dist/es/framer-motion/dist/es/render/dom/scroll/supports.mjs +0 -5
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/utils/calc-duration.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/generators/utils/is-generator.mjs +0 -0
- /package/dist/es/{framer-motion → motion-dom}/dist/es/animation/utils/get-value-transition.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/animation/animators → motion-dom/dist/es/animation}/waapi/utils/attach-timeline.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/easing → motion-dom/dist/es}/utils/is-bezier-definition.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/supports-flags.mjs → motion-dom/dist/es/utils/supports/flags.mjs} +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/memo.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/progress.mjs +0 -0
- /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/time-conversion.mjs +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { secondsToMilliseconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
3
|
+
import { createGeneratorEasing } from '../../../../../../motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs';
|
|
4
|
+
import { isGenerator } from '../../../../../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs';
|
|
5
|
+
import { NativeAnimationControls } from '../../../../../../motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs';
|
|
6
|
+
import { supportsLinearEasing } from '../../../../../../motion-dom/dist/es/utils/supports/linear-easing.mjs';
|
|
1
7
|
import { startWaapiAnimation } from './index.mjs';
|
|
2
|
-
import { createGeneratorEasing } from '../../../easing/utils/create-generator-easing.mjs';
|
|
3
8
|
import { browserNumberValueTypes } from '../../../render/dom/value-types/number-browser.mjs';
|
|
4
|
-
import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
5
|
-
import { noop } from '../../../../../../motion-utils/dist/es/noop.mjs';
|
|
6
|
-
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../utils/time-conversion.mjs';
|
|
7
|
-
import { isGenerator } from '../../generators/utils/is-generator.mjs';
|
|
8
|
-
import { attachTimeline } from './utils/attach-timeline.mjs';
|
|
9
9
|
import { getFinalKeyframe } from './utils/get-final-keyframe.mjs';
|
|
10
10
|
import { setCSSVar, setStyle } from './utils/style.mjs';
|
|
11
|
-
import { supportsLinearEasing } from './utils/supports-linear-easing.mjs';
|
|
12
11
|
import { supportsPartialKeyframes } from './utils/supports-partial-keyframes.mjs';
|
|
13
12
|
import { supportsWaapi } from './utils/supports-waapi.mjs';
|
|
14
13
|
|
|
@@ -33,12 +32,9 @@ function getElementAnimationState(element) {
|
|
|
33
32
|
state.set(element, animationState);
|
|
34
33
|
return state.get(element);
|
|
35
34
|
}
|
|
36
|
-
class NativeAnimation {
|
|
35
|
+
class NativeAnimation extends NativeAnimationControls {
|
|
37
36
|
constructor(element, valueName, valueKeyframes, options) {
|
|
38
37
|
const isCSSVar = valueName.startsWith("--");
|
|
39
|
-
this.setValue = isCSSVar ? setCSSVar : setStyle;
|
|
40
|
-
this.options = options;
|
|
41
|
-
this.updateFinishedPromise();
|
|
42
38
|
invariant(typeof options.type !== "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "framer-motion"?`);
|
|
43
39
|
const existingAnimation = getElementAnimationState(element).get(valueName);
|
|
44
40
|
existingAnimation && existingAnimation.stop();
|
|
@@ -63,92 +59,32 @@ class NativeAnimation {
|
|
|
63
59
|
else {
|
|
64
60
|
options.ease = options.ease || defaultEasing;
|
|
65
61
|
}
|
|
66
|
-
this.removeAnimation = () => { var _a; return (_a = state.get(element)) === null || _a === void 0 ? void 0 : _a.delete(valueName); };
|
|
67
62
|
const onFinish = () => {
|
|
68
|
-
this.setValue(element, valueName, getFinalKeyframe(valueKeyframes,
|
|
63
|
+
this.setValue(element, valueName, getFinalKeyframe(valueKeyframes, options));
|
|
69
64
|
this.cancel();
|
|
70
65
|
this.resolveFinishedPromise();
|
|
71
66
|
};
|
|
67
|
+
const init = () => {
|
|
68
|
+
this.setValue = isCSSVar ? setCSSVar : setStyle;
|
|
69
|
+
this.options = options;
|
|
70
|
+
this.updateFinishedPromise();
|
|
71
|
+
this.removeAnimation = () => { var _a; return (_a = state.get(element)) === null || _a === void 0 ? void 0 : _a.delete(valueName); };
|
|
72
|
+
};
|
|
72
73
|
if (!supportsWaapi()) {
|
|
74
|
+
super();
|
|
75
|
+
init();
|
|
73
76
|
onFinish();
|
|
74
77
|
}
|
|
75
78
|
else {
|
|
76
|
-
|
|
79
|
+
super(startWaapiAnimation(element, valueName, valueKeyframes, options));
|
|
80
|
+
init();
|
|
77
81
|
if (options.autoplay === false) {
|
|
78
82
|
this.animation.pause();
|
|
79
83
|
}
|
|
80
84
|
this.animation.onfinish = onFinish;
|
|
81
|
-
if (this.pendingTimeline) {
|
|
82
|
-
attachTimeline(this.animation, this.pendingTimeline);
|
|
83
|
-
}
|
|
84
85
|
getElementAnimationState(element).set(valueName, this);
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
get duration() {
|
|
88
|
-
return millisecondsToSeconds(this.options.duration || 300);
|
|
89
|
-
}
|
|
90
|
-
get time() {
|
|
91
|
-
var _a;
|
|
92
|
-
if (this.animation) {
|
|
93
|
-
return millisecondsToSeconds(((_a = this.animation) === null || _a === void 0 ? void 0 : _a.currentTime) || 0);
|
|
94
|
-
}
|
|
95
|
-
return 0;
|
|
96
|
-
}
|
|
97
|
-
set time(newTime) {
|
|
98
|
-
if (this.animation) {
|
|
99
|
-
this.animation.currentTime = secondsToMilliseconds(newTime);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
get speed() {
|
|
103
|
-
return this.animation ? this.animation.playbackRate : 1;
|
|
104
|
-
}
|
|
105
|
-
set speed(newSpeed) {
|
|
106
|
-
if (this.animation) {
|
|
107
|
-
this.animation.playbackRate = newSpeed;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
get state() {
|
|
111
|
-
return this.animation ? this.animation.playState : "finished";
|
|
112
|
-
}
|
|
113
|
-
get startTime() {
|
|
114
|
-
return this.animation ? this.animation.startTime : null;
|
|
115
|
-
}
|
|
116
|
-
flatten() {
|
|
117
|
-
var _a;
|
|
118
|
-
if (!this.animation)
|
|
119
|
-
return;
|
|
120
|
-
(_a = this.animation.effect) === null || _a === void 0 ? void 0 : _a.updateTiming({ easing: "linear" });
|
|
121
|
-
}
|
|
122
|
-
play() {
|
|
123
|
-
if (this.state === "finished") {
|
|
124
|
-
this.updateFinishedPromise();
|
|
125
|
-
}
|
|
126
|
-
this.animation && this.animation.play();
|
|
127
|
-
}
|
|
128
|
-
pause() {
|
|
129
|
-
this.animation && this.animation.pause();
|
|
130
|
-
}
|
|
131
|
-
stop() {
|
|
132
|
-
if (!this.animation ||
|
|
133
|
-
this.state === "idle" ||
|
|
134
|
-
this.state === "finished") {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (this.animation.commitStyles) {
|
|
138
|
-
this.animation.commitStyles();
|
|
139
|
-
}
|
|
140
|
-
this.cancel();
|
|
141
|
-
}
|
|
142
|
-
complete() {
|
|
143
|
-
this.animation && this.animation.finish();
|
|
144
|
-
}
|
|
145
|
-
cancel() {
|
|
146
|
-
this.removeAnimation();
|
|
147
|
-
try {
|
|
148
|
-
this.animation && this.animation.cancel();
|
|
149
|
-
}
|
|
150
|
-
catch (e) { }
|
|
151
|
-
}
|
|
152
88
|
/**
|
|
153
89
|
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
154
90
|
* resolves when the animation finishes at all but in a future update could/should
|
|
@@ -162,14 +98,15 @@ class NativeAnimation {
|
|
|
162
98
|
this.resolveFinishedPromise = resolve;
|
|
163
99
|
});
|
|
164
100
|
}
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
this.
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
attachTimeline(this.animation, timeline);
|
|
101
|
+
play() {
|
|
102
|
+
if (this.state === "finished") {
|
|
103
|
+
this.updateFinishedPromise();
|
|
171
104
|
}
|
|
172
|
-
|
|
105
|
+
super.play();
|
|
106
|
+
}
|
|
107
|
+
cancel() {
|
|
108
|
+
this.removeAnimation();
|
|
109
|
+
super.cancel();
|
|
173
110
|
}
|
|
174
111
|
}
|
|
175
112
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
|
|
2
1
|
import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
3
|
-
import { secondsToMilliseconds } from '
|
|
4
|
-
import { getValueTransition } from '
|
|
2
|
+
import { secondsToMilliseconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
3
|
+
import { getValueTransition } from '../../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
|
|
4
|
+
import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
|
|
5
5
|
import { NativeAnimation } from './NativeAnimation.mjs';
|
|
6
6
|
|
|
7
7
|
function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GroupPlaybackControls } from '
|
|
1
|
+
import { GroupPlaybackControls } from '../../../../../../motion-dom/dist/es/animation/controls/Group.mjs';
|
|
2
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
3
|
import { animateElements } from './animate-elements.mjs';
|
|
3
4
|
|
|
4
5
|
const createScopedWaapiAnimate = (scope) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { mapEasingToNativeEasing } from '../../../../../../motion-dom/dist/es/animation/waapi/utils/easing.mjs';
|
|
2
3
|
|
|
3
4
|
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
|
|
4
5
|
const keyframeOptions = { [valueName]: keyframes };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { memo } from '../../../../../../../motion-utils/dist/es/memo.mjs';
|
|
2
3
|
|
|
3
4
|
const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
4
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { warning } from '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
2
3
|
import { clamp } from '../../../utils/clamp.mjs';
|
|
3
|
-
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../utils/time-conversion.mjs';
|
|
4
4
|
import { springDefaults } from './defaults.mjs';
|
|
5
5
|
|
|
6
6
|
const safeMin = 0.001;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { millisecondsToSeconds, secondsToMilliseconds } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { calcGeneratorDuration, maxGeneratorDuration } from '../utils/calc-duration.mjs';
|
|
1
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { millisecondsToSeconds, secondsToMilliseconds } from '../../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
3
|
+
import { calcGeneratorDuration, maxGeneratorDuration } from '../../../../../../motion-dom/dist/es/animation/generators/utils/calc-duration.mjs';
|
|
4
|
+
import { generateLinearEasing } from '../../../../../../motion-dom/dist/es/animation/waapi/utils/linear.mjs';
|
|
6
5
|
import { clamp } from '../../../utils/clamp.mjs';
|
|
6
|
+
import { calcGeneratorVelocity } from '../utils/velocity.mjs';
|
|
7
7
|
import { springDefaults } from './defaults.mjs';
|
|
8
|
+
import { findSpring, calcAngularFreq } from './find.mjs';
|
|
8
9
|
|
|
9
10
|
const durationKeys = ["duration", "bounce"];
|
|
10
11
|
const physicsKeys = ["stiffness", "damping", "mass"];
|
|
@@ -27,7 +28,9 @@ function getSpringOptions(options) {
|
|
|
27
28
|
const visualDuration = options.visualDuration;
|
|
28
29
|
const root = (2 * Math.PI) / (visualDuration * 1.2);
|
|
29
30
|
const stiffness = root * root;
|
|
30
|
-
const damping = 2 *
|
|
31
|
+
const damping = 2 *
|
|
32
|
+
clamp(0.05, 1, 1 - (options.bounce || 0)) *
|
|
33
|
+
Math.sqrt(stiffness);
|
|
31
34
|
springOptions = {
|
|
32
35
|
...springOptions,
|
|
33
36
|
mass: springDefaults.mass,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { GroupPlaybackControls } from '../../../../../motion-dom/dist/es/animation/controls/Group.mjs';
|
|
2
|
+
import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
|
|
3
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
4
|
+
import { secondsToMilliseconds } from '../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
5
|
+
import { frame } from '../../frameloop/frame.mjs';
|
|
4
6
|
import { MotionGlobalConfig } from '../../utils/GlobalConfig.mjs';
|
|
5
7
|
import { instantAnimationState } from '../../utils/use-instant-transition-state.mjs';
|
|
6
|
-
import { getFinalKeyframe } from '../animators/waapi/utils/get-final-keyframe.mjs';
|
|
7
|
-
import { frame } from '../../frameloop/frame.mjs';
|
|
8
8
|
import { AcceleratedAnimation } from '../animators/AcceleratedAnimation.mjs';
|
|
9
9
|
import { MainThreadAnimation } from '../animators/MainThreadAnimation.mjs';
|
|
10
|
-
import {
|
|
10
|
+
import { getFinalKeyframe } from '../animators/waapi/utils/get-final-keyframe.mjs';
|
|
11
|
+
import { getDefaultTransition } from '../utils/default-transitions.mjs';
|
|
11
12
|
import { isTransitionDefined } from '../utils/is-transition-defined.mjs';
|
|
12
13
|
|
|
13
14
|
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
|
|
1
3
|
import { transformProps } from '../../render/html/utils/transform.mjs';
|
|
2
|
-
import { animateMotionValue } from './motion-value.mjs';
|
|
3
4
|
import { setTarget } from '../../render/utils/setters.mjs';
|
|
4
|
-
import { getValueTransition } from '../utils/get-value-transition.mjs';
|
|
5
|
-
import { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';
|
|
6
5
|
import { addValueToWillChange } from '../../value/use-will-change/add-will-change.mjs';
|
|
6
|
+
import { getOptimisedAppearId } from '../optimized-appear/get-appear-id.mjs';
|
|
7
|
+
import { animateMotionValue } from './motion-value.mjs';
|
|
7
8
|
import { frame } from '../../frameloop/frame.mjs';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { progress } from '../../../../../motion-utils/dist/es/progress.mjs';
|
|
3
|
+
import { secondsToMilliseconds } from '../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
4
|
+
import { createGeneratorEasing } from '../../../../../motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs';
|
|
5
|
+
import { isGenerator } from '../../../../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs';
|
|
6
|
+
import { getEasingForSegment } from '../../easing/utils/get-easing-for-segment.mjs';
|
|
2
7
|
import { defaultOffset } from '../../utils/offsets/default.mjs';
|
|
3
8
|
import { fillOffset } from '../../utils/offsets/fill.mjs';
|
|
4
|
-
import { progress } from '../../utils/progress.mjs';
|
|
5
|
-
import { secondsToMilliseconds } from '../../utils/time-conversion.mjs';
|
|
6
9
|
import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
|
|
7
10
|
import { resolveSubjects } from '../animate/resolve-subjects.mjs';
|
|
8
|
-
import {
|
|
11
|
+
import { calculateRepeatDuration } from './utils/calc-repeat-duration.mjs';
|
|
9
12
|
import { calcNextTime } from './utils/calc-time.mjs';
|
|
10
13
|
import { addKeyframes } from './utils/edit.mjs';
|
|
14
|
+
import { normalizeTimes } from './utils/normalize-times.mjs';
|
|
11
15
|
import { compareByTime } from './utils/sort.mjs';
|
|
12
16
|
|
|
13
17
|
const defaultSegmentEasing = "easeInOut";
|
|
18
|
+
const MAX_REPEAT = 20;
|
|
14
19
|
function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...sequenceTransition } = {}, scope, generators) {
|
|
15
20
|
const defaultDuration = defaultTransition.duration || 0.3;
|
|
16
21
|
const animationDefinitions = new Map();
|
|
@@ -53,7 +58,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
53
58
|
let maxDuration = 0;
|
|
54
59
|
const resolveValueSequence = (valueKeyframes, valueTransition, valueSequence, elementIndex = 0, numSubjects = 0) => {
|
|
55
60
|
const valueKeyframesAsList = keyframesAsList(valueKeyframes);
|
|
56
|
-
const { delay = 0, times = defaultOffset(valueKeyframesAsList), type = "keyframes", ...remainingTransition } = valueTransition;
|
|
61
|
+
const { delay = 0, times = defaultOffset(valueKeyframesAsList), type = "keyframes", repeat, repeatType, repeatDelay = 0, ...remainingTransition } = valueTransition;
|
|
57
62
|
let { ease = defaultTransition.ease || "easeOut", duration } = valueTransition;
|
|
58
63
|
/**
|
|
59
64
|
* Resolve stagger() if defined.
|
|
@@ -91,7 +96,6 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
91
96
|
}
|
|
92
97
|
duration !== null && duration !== void 0 ? duration : (duration = defaultDuration);
|
|
93
98
|
const startTime = currentTime + calculatedDelay;
|
|
94
|
-
const targetTime = startTime + duration;
|
|
95
99
|
/**
|
|
96
100
|
* If there's only one time offset of 0, fill in a second with length 1
|
|
97
101
|
*/
|
|
@@ -110,6 +114,28 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
110
114
|
*/
|
|
111
115
|
valueKeyframesAsList.length === 1 &&
|
|
112
116
|
valueKeyframesAsList.unshift(null);
|
|
117
|
+
/**
|
|
118
|
+
* Handle repeat options
|
|
119
|
+
*/
|
|
120
|
+
if (repeat) {
|
|
121
|
+
invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
|
|
122
|
+
duration = calculateRepeatDuration(duration, repeat);
|
|
123
|
+
const originalKeyframes = [...valueKeyframesAsList];
|
|
124
|
+
const originalTimes = [...times];
|
|
125
|
+
ease = Array.isArray(ease) ? [...ease] : [ease];
|
|
126
|
+
const originalEase = [...ease];
|
|
127
|
+
for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) {
|
|
128
|
+
valueKeyframesAsList.push(...originalKeyframes);
|
|
129
|
+
for (let keyframeIndex = 0; keyframeIndex < originalKeyframes.length; keyframeIndex++) {
|
|
130
|
+
times.push(originalTimes[keyframeIndex] + (repeatIndex + 1));
|
|
131
|
+
ease.push(keyframeIndex === 0
|
|
132
|
+
? "linear"
|
|
133
|
+
: getEasingForSegment(originalEase, keyframeIndex - 1));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
normalizeTimes(times, repeat);
|
|
137
|
+
}
|
|
138
|
+
const targetTime = startTime + duration;
|
|
113
139
|
/**
|
|
114
140
|
* Add keyframes, mapping offsets to absolute time.
|
|
115
141
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Take an array of times that represent repeated keyframes. For instance
|
|
3
|
+
* if we have original times of [0, 0.5, 1] then our repeated times will
|
|
4
|
+
* be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back
|
|
5
|
+
* down to a 0-1 scale.
|
|
6
|
+
*/
|
|
7
|
+
function normalizeTimes(times, repeat) {
|
|
8
|
+
for (let i = 0; i < times.length; i++) {
|
|
9
|
+
times[i] = times[i] / (repeat + 1);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { normalizeTimes };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
2
|
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
3
|
+
import { isBezierDefinition } from '../../../../../motion-dom/dist/es/utils/is-bezier-definition.mjs';
|
|
4
|
+
import { anticipate } from '../anticipate.mjs';
|
|
5
|
+
import { backIn, backInOut, backOut } from '../back.mjs';
|
|
6
|
+
import { circIn, circInOut, circOut } from '../circ.mjs';
|
|
3
7
|
import { cubicBezier } from '../cubic-bezier.mjs';
|
|
4
8
|
import { easeIn, easeInOut, easeOut } from '../ease.mjs';
|
|
5
|
-
import { circIn, circInOut, circOut } from '../circ.mjs';
|
|
6
|
-
import { backIn, backInOut, backOut } from '../back.mjs';
|
|
7
|
-
import { anticipate } from '../anticipate.mjs';
|
|
8
|
-
import { isBezierDefinition } from './is-bezier-definition.mjs';
|
|
9
9
|
|
|
10
10
|
const easingLookup = {
|
|
11
11
|
linear: noop,
|
|
@@ -63,10 +63,11 @@ function createRenderStep(runNextFrame) {
|
|
|
63
63
|
}
|
|
64
64
|
isProcessing = true;
|
|
65
65
|
[thisFrame, nextFrame] = [nextFrame, thisFrame];
|
|
66
|
-
// Clear the next frame queue
|
|
67
|
-
nextFrame.clear();
|
|
68
66
|
// Execute this frame
|
|
69
67
|
thisFrame.forEach(triggerCallback);
|
|
68
|
+
// Clear the frame so no callbacks remain. This is to avoid
|
|
69
|
+
// memory leaks should this render step not run for a while.
|
|
70
|
+
thisFrame.clear();
|
|
70
71
|
isProcessing = false;
|
|
71
72
|
if (flushNextFrame) {
|
|
72
73
|
flushNextFrame = false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { progress } from '../../../../../../motion-utils/dist/es/progress.mjs';
|
|
2
3
|
import { calcLength } from '../../../projection/geometry/delta-calc.mjs';
|
|
3
4
|
import { clamp } from '../../../utils/clamp.mjs';
|
|
4
5
|
import { mixNumber } from '../../../utils/mix/number.mjs';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Feature } from '../motion/features/Feature.mjs';
|
|
2
|
+
import '../../../../motion-utils/dist/es/errors.mjs';
|
|
2
3
|
import { hover } from '../../../../motion-dom/dist/es/gestures/hover.mjs';
|
|
3
4
|
import { extractEventInfo } from '../events/event-info.mjs';
|
|
4
5
|
import { frame } from '../frameloop/frame.mjs';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { secondsToMilliseconds, millisecondsToSeconds } from '
|
|
1
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { secondsToMilliseconds, millisecondsToSeconds } from '../../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
3
|
+
import { isPrimaryPointer } from '../../../../../motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs';
|
|
3
4
|
import { addPointerEvent } from '../../events/add-pointer-event.mjs';
|
|
4
|
-
import {
|
|
5
|
+
import { extractEventInfo } from '../../events/event-info.mjs';
|
|
5
6
|
import { distance2D } from '../../utils/distance.mjs';
|
|
6
|
-
import {
|
|
7
|
+
import { pipe } from '../../utils/pipe.mjs';
|
|
7
8
|
import { frame, cancelFrame, frameData } from '../../frameloop/frame.mjs';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Feature } from '../motion/features/Feature.mjs';
|
|
2
|
+
import '../../../../motion-utils/dist/es/errors.mjs';
|
|
2
3
|
import { press } from '../../../../motion-dom/dist/es/gestures/press/index.mjs';
|
|
3
4
|
import { extractEventInfo } from '../events/event-info.mjs';
|
|
4
5
|
import { frame } from '../frameloop/frame.mjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { circOut } from '../../easing/circ.mjs';
|
|
2
|
-
import { progress } from '../../utils/progress.mjs';
|
|
3
|
-
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
4
1
|
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
5
2
|
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
3
|
+
import { progress } from '../../../../../motion-utils/dist/es/progress.mjs';
|
|
4
|
+
import { circOut } from '../../easing/circ.mjs';
|
|
5
|
+
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
6
6
|
import { percent, px } from '../../value/types/numbers/units.mjs';
|
|
7
7
|
|
|
8
8
|
const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
3
|
+
import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
|
|
4
|
+
import { animateSingleValue } from '../../animation/animate/single-value.mjs';
|
|
5
|
+
import { getOptimisedAppearId } from '../../animation/optimized-appear/get-appear-id.mjs';
|
|
6
|
+
import { cancelFrame, frameData, frameSteps, frame } from '../../frameloop/frame.mjs';
|
|
7
|
+
import { microtask } from '../../frameloop/microtask.mjs';
|
|
8
|
+
import { time } from '../../frameloop/sync-time.mjs';
|
|
9
|
+
import { isSVGElement } from '../../render/dom/utils/is-svg-element.mjs';
|
|
10
|
+
import { FlatTree } from '../../render/utils/flat-tree.mjs';
|
|
11
|
+
import { clamp } from '../../utils/clamp.mjs';
|
|
12
|
+
import { delay } from '../../utils/delay.mjs';
|
|
13
|
+
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
1
14
|
import { SubscriptionManager } from '../../utils/subscription-manager.mjs';
|
|
15
|
+
import { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';
|
|
2
16
|
import { mixValues } from '../animation/mix-values.mjs';
|
|
3
17
|
import { copyBoxInto, copyAxisDeltaInto } from '../geometry/copy.mjs';
|
|
4
18
|
import { translateAxis, transformBox, applyBoxDelta, applyTreeDeltas } from '../geometry/delta-apply.mjs';
|
|
5
19
|
import { calcRelativePosition, calcRelativeBox, calcBoxDelta, calcLength, isNear } from '../geometry/delta-calc.mjs';
|
|
6
20
|
import { removeBoxTransforms } from '../geometry/delta-remove.mjs';
|
|
7
|
-
import {
|
|
21
|
+
import { createBox, createDelta } from '../geometry/models.mjs';
|
|
8
22
|
import { boxEqualsRounded, isDeltaZero, axisDeltaEquals, aspectRatio, boxEquals } from '../geometry/utils.mjs';
|
|
9
23
|
import { NodeStack } from '../shared/stack.mjs';
|
|
10
24
|
import { scaleCorrectors } from '../styles/scale-correction.mjs';
|
|
11
25
|
import { buildProjectionTransform } from '../styles/transform.mjs';
|
|
12
26
|
import { eachAxis } from '../utils/each-axis.mjs';
|
|
13
27
|
import { hasTransform, hasScale, has2DTranslate } from '../utils/has-transform.mjs';
|
|
14
|
-
import { FlatTree } from '../../render/utils/flat-tree.mjs';
|
|
15
|
-
import { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';
|
|
16
28
|
import { globalProjectionState } from './state.mjs';
|
|
17
|
-
import { delay } from '../../utils/delay.mjs';
|
|
18
|
-
import { mixNumber } from '../../utils/mix/number.mjs';
|
|
19
|
-
import { isSVGElement } from '../../render/dom/utils/is-svg-element.mjs';
|
|
20
|
-
import { animateSingleValue } from '../../animation/animate/single-value.mjs';
|
|
21
|
-
import { clamp } from '../../utils/clamp.mjs';
|
|
22
|
-
import { cancelFrame, frameData, frameSteps, frame } from '../../frameloop/frame.mjs';
|
|
23
|
-
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
24
|
-
import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
|
|
25
|
-
import { time } from '../../frameloop/sync-time.mjs';
|
|
26
|
-
import { microtask } from '../../frameloop/microtask.mjs';
|
|
27
|
-
import { getOptimisedAppearId } from '../../animation/optimized-appear/get-appear-id.mjs';
|
|
28
|
-
import { createBox, createDelta } from '../geometry/models.mjs';
|
|
29
29
|
|
|
30
30
|
const metrics = {
|
|
31
31
|
type: "projectionFrame",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { observeTimeline } from './observe.mjs';
|
|
3
|
-
import { supportsScrollTimeline } from './supports.mjs';
|
|
1
|
+
import { supportsScrollTimeline } from '../../../../../../motion-dom/dist/es/utils/supports/scroll-timeline.mjs';
|
|
4
2
|
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
5
3
|
import { noop } from '../../../../../../motion-utils/dist/es/noop.mjs';
|
|
4
|
+
import { observeTimeline } from './observe.mjs';
|
|
5
|
+
import { scrollInfo } from './track.mjs';
|
|
6
6
|
|
|
7
7
|
function scrollTimelineFallback({ source, container, axis = "y", }) {
|
|
8
8
|
// Support legacy source argument. Deprecate later.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { progress } from '../../../../../../motion-utils/dist/es/progress.mjs';
|
|
2
3
|
import { velocityPerSecond } from '../../../utils/velocity-per-second.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -17,7 +17,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
17
17
|
* and warn against mismatches.
|
|
18
18
|
*/
|
|
19
19
|
if (process.env.NODE_ENV === "development") {
|
|
20
|
-
warnOnce(nextValue.version === "11.
|
|
20
|
+
warnOnce(nextValue.version === "11.16.0", `Attempting to mix Motion versions ${nextValue.version} with 11.16.0 may not work as expected.`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
else if (isMotionValue(prevValue)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import '../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { secondsToMilliseconds } from '../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
1
3
|
import { time } from '../frameloop/sync-time.mjs';
|
|
2
|
-
import { secondsToMilliseconds } from './time-conversion.mjs';
|
|
3
4
|
import { frame, cancelFrame } from '../frameloop/frame.mjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { clamp } from './clamp.mjs';
|
|
2
|
-
import { pipe } from './pipe.mjs';
|
|
3
|
-
import { progress } from './progress.mjs';
|
|
4
1
|
import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
5
2
|
import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
|
|
3
|
+
import { progress } from '../../../../motion-utils/dist/es/progress.mjs';
|
|
4
|
+
import { clamp } from './clamp.mjs';
|
|
6
5
|
import { mix } from './mix/index.mjs';
|
|
6
|
+
import { pipe } from './pipe.mjs';
|
|
7
7
|
|
|
8
8
|
function createMixers(output, ease, customMixer) {
|
|
9
9
|
const mixers = [];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import '../../../../../motion-utils/dist/es/errors.mjs';
|
|
2
|
+
import { progress } from '../../../../../motion-utils/dist/es/progress.mjs';
|
|
1
3
|
import { mixNumber } from '../mix/number.mjs';
|
|
2
|
-
import { progress } from '../progress.mjs';
|
|
3
4
|
|
|
4
5
|
function fillOffset(offset, remaining) {
|
|
5
6
|
const min = offset[offset.length - 1];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { time } from '../frameloop/sync-time.mjs';
|
|
1
2
|
import { SubscriptionManager } from '../utils/subscription-manager.mjs';
|
|
2
3
|
import { velocityPerSecond } from '../utils/velocity-per-second.mjs';
|
|
3
4
|
import { warnOnce } from '../utils/warn-once.mjs';
|
|
4
|
-
import { time } from '../frameloop/sync-time.mjs';
|
|
5
5
|
import { frame } from '../frameloop/frame.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -34,7 +34,7 @@ class MotionValue {
|
|
|
34
34
|
* This will be replaced by the build step with the latest version number.
|
|
35
35
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
36
36
|
*/
|
|
37
|
-
this.version = "11.
|
|
37
|
+
this.version = "11.16.0";
|
|
38
38
|
/**
|
|
39
39
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
40
40
|
* if the value is numerical, but we might be able to widen the scope here and support
|