framer-motion 8.1.8 → 8.2.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/dist/cjs/index.js +64 -42
- package/dist/es/animation/index.mjs +13 -24
- package/dist/es/animation/waapi/create-accelerated-animation.mjs +23 -1
- package/dist/es/index.mjs +5 -0
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +64 -42
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +17 -1
- package/dist/projection.dev.js +53 -42
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-webpack-dom-animation.js +1 -1
- package/dist/size-webpack-dom-max.js +1 -1
- package/package.json +7 -7
package/dist/cjs/index.js
CHANGED
|
@@ -2055,7 +2055,7 @@ class MotionValue {
|
|
|
2055
2055
|
* This will be replaced by the build step with the latest version number.
|
|
2056
2056
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2057
2057
|
*/
|
|
2058
|
-
this.version = "8.
|
|
2058
|
+
this.version = "8.2.0";
|
|
2059
2059
|
/**
|
|
2060
2060
|
* Duration, in milliseconds, since last updating frame.
|
|
2061
2061
|
*
|
|
@@ -3613,6 +3613,22 @@ function animateStyle(element, valueName, keyframes, { delay = 0, duration, repe
|
|
|
3613
3613
|
});
|
|
3614
3614
|
}
|
|
3615
3615
|
|
|
3616
|
+
const featureTests = {
|
|
3617
|
+
waapi: () => Object.hasOwnProperty.call(Element.prototype, "animate"),
|
|
3618
|
+
};
|
|
3619
|
+
const results = {};
|
|
3620
|
+
const supports = {};
|
|
3621
|
+
/**
|
|
3622
|
+
* Generate features tests that cache their results.
|
|
3623
|
+
*/
|
|
3624
|
+
for (const key in featureTests) {
|
|
3625
|
+
supports[key] = () => {
|
|
3626
|
+
if (results[key] === undefined)
|
|
3627
|
+
results[key] = featureTests[key]();
|
|
3628
|
+
return results[key];
|
|
3629
|
+
};
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3616
3632
|
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }) {
|
|
3617
3633
|
const index = repeat && repeatType !== "loop" && repeat % 2 === 1
|
|
3618
3634
|
? 0
|
|
@@ -3620,6 +3636,10 @@ function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }) {
|
|
|
3620
3636
|
return keyframes[index];
|
|
3621
3637
|
}
|
|
3622
3638
|
|
|
3639
|
+
/**
|
|
3640
|
+
* A list of values that can be hardware-accelerated.
|
|
3641
|
+
*/
|
|
3642
|
+
const acceleratedValues = new Set(["opacity"]);
|
|
3623
3643
|
/**
|
|
3624
3644
|
* 10ms is chosen here as it strikes a balance between smooth
|
|
3625
3645
|
* results (more than one keyframe per frame at 60fps) and
|
|
@@ -3627,16 +3647,33 @@ function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }) {
|
|
|
3627
3647
|
*/
|
|
3628
3648
|
const sampleDelta = 10; //ms
|
|
3629
3649
|
function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ...options }) {
|
|
3650
|
+
const canAccelerateAnimation = supports.waapi() &&
|
|
3651
|
+
acceleratedValues.has(valueName) &&
|
|
3652
|
+
!options.repeatDelay &&
|
|
3653
|
+
options.repeatType !== "mirror" &&
|
|
3654
|
+
options.damping !== 0;
|
|
3655
|
+
if (!canAccelerateAnimation)
|
|
3656
|
+
return false;
|
|
3630
3657
|
let { keyframes, duration = 300, elapsed = 0, ease } = options;
|
|
3631
3658
|
/**
|
|
3632
3659
|
* If this animation needs pre-generated keyframes then generate.
|
|
3633
3660
|
*/
|
|
3634
3661
|
if (options.type === "spring" || !isWaapiSupportedEasing(options.ease)) {
|
|
3662
|
+
/**
|
|
3663
|
+
* If we need to pre-generate keyframes and repeat is infinite then
|
|
3664
|
+
* early return as this will lock the thread.
|
|
3665
|
+
*/
|
|
3666
|
+
if (options.repeat === Infinity)
|
|
3667
|
+
return;
|
|
3635
3668
|
const sampleAnimation = animate$1(options);
|
|
3636
3669
|
let state = { done: false, value: keyframes[0] };
|
|
3637
3670
|
const pregeneratedKeyframes = [];
|
|
3671
|
+
/**
|
|
3672
|
+
* Bail after 20 seconds of pre-generated keyframes as it's likely
|
|
3673
|
+
* we're heading for an infinite loop.
|
|
3674
|
+
*/
|
|
3638
3675
|
let t = 0;
|
|
3639
|
-
while (!state.done) {
|
|
3676
|
+
while (!state.done && t < 20000) {
|
|
3640
3677
|
state = sampleAnimation.sample(t);
|
|
3641
3678
|
pregeneratedKeyframes.push(state.value);
|
|
3642
3679
|
t += sampleDelta;
|
|
@@ -3936,26 +3973,6 @@ function getKeyframes(value, valueName, target, transition) {
|
|
|
3936
3973
|
}
|
|
3937
3974
|
}
|
|
3938
3975
|
|
|
3939
|
-
const featureTests = {
|
|
3940
|
-
waapi: () => Object.hasOwnProperty.call(Element.prototype, "animate"),
|
|
3941
|
-
};
|
|
3942
|
-
const results = {};
|
|
3943
|
-
const supports = {};
|
|
3944
|
-
/**
|
|
3945
|
-
* Generate features tests that cache their results.
|
|
3946
|
-
*/
|
|
3947
|
-
for (const key in featureTests) {
|
|
3948
|
-
supports[key] = () => {
|
|
3949
|
-
if (results[key] === undefined)
|
|
3950
|
-
results[key] = featureTests[key]();
|
|
3951
|
-
return results[key];
|
|
3952
|
-
};
|
|
3953
|
-
}
|
|
3954
|
-
|
|
3955
|
-
/**
|
|
3956
|
-
* A list of values that can be hardware-accelerated.
|
|
3957
|
-
*/
|
|
3958
|
-
const acceleratedValues = new Set(["opacity"]);
|
|
3959
3976
|
const createMotionValueAnimation = (valueName, value, target, transition = {}) => {
|
|
3960
3977
|
return (onComplete) => {
|
|
3961
3978
|
const valueTransition = getValueTransition(transition, valueName) || {};
|
|
@@ -4037,27 +4054,21 @@ const createMotionValueAnimation = (valueName, value, target, transition = {}) =
|
|
|
4037
4054
|
}
|
|
4038
4055
|
const visualElement = value.owner;
|
|
4039
4056
|
const element = visualElement && visualElement.current;
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
options.damping !== 0 &&
|
|
4045
|
-
visualElement &&
|
|
4057
|
+
/**
|
|
4058
|
+
* Animate via WAAPI if possible.
|
|
4059
|
+
*/
|
|
4060
|
+
if (visualElement &&
|
|
4046
4061
|
element instanceof HTMLElement &&
|
|
4047
|
-
!visualElement.getProps().onUpdate
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
*/
|
|
4052
|
-
return createAcceleratedAnimation(value, valueName, options);
|
|
4053
|
-
}
|
|
4054
|
-
else {
|
|
4055
|
-
/**
|
|
4056
|
-
* Otherwise, fall back to the main thread.
|
|
4057
|
-
*/
|
|
4058
|
-
const animation = animate$1(options);
|
|
4059
|
-
return () => animation.stop();
|
|
4062
|
+
!(visualElement === null || visualElement === void 0 ? void 0 : visualElement.getProps().onUpdate)) {
|
|
4063
|
+
const acceleratedAnimation = createAcceleratedAnimation(value, valueName, options);
|
|
4064
|
+
if (acceleratedAnimation)
|
|
4065
|
+
return acceleratedAnimation;
|
|
4060
4066
|
}
|
|
4067
|
+
/**
|
|
4068
|
+
* If we didn't create an accelerated animation, create a JS animation
|
|
4069
|
+
*/
|
|
4070
|
+
const animation = animate$1(options);
|
|
4071
|
+
return () => animation.stop();
|
|
4061
4072
|
};
|
|
4062
4073
|
};
|
|
4063
4074
|
|
|
@@ -5900,7 +5911,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
5900
5911
|
* and warn against mismatches.
|
|
5901
5912
|
*/
|
|
5902
5913
|
if (process.env.NODE_ENV === "development") {
|
|
5903
|
-
warnOnce(nextValue.version === "8.
|
|
5914
|
+
warnOnce(nextValue.version === "8.2.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.2.0 may not work as expected.`);
|
|
5904
5915
|
}
|
|
5905
5916
|
}
|
|
5906
5917
|
else if (isMotionValue(prevValue)) {
|
|
@@ -9878,18 +9889,29 @@ exports.animate = animate;
|
|
|
9878
9889
|
exports.animateVisualElement = animateVisualElement;
|
|
9879
9890
|
exports.animationControls = animationControls;
|
|
9880
9891
|
exports.animations = animations;
|
|
9892
|
+
exports.anticipate = anticipate;
|
|
9893
|
+
exports.backIn = backIn;
|
|
9894
|
+
exports.backInOut = backInOut;
|
|
9895
|
+
exports.backOut = backOut;
|
|
9881
9896
|
exports.buildTransform = buildTransform;
|
|
9882
9897
|
exports.calcLength = calcLength;
|
|
9883
9898
|
exports.checkTargetForNewValues = checkTargetForNewValues;
|
|
9899
|
+
exports.circIn = circIn;
|
|
9900
|
+
exports.circInOut = circInOut;
|
|
9901
|
+
exports.circOut = circOut;
|
|
9884
9902
|
exports.clamp = clamp;
|
|
9885
9903
|
exports.createBox = createBox;
|
|
9886
9904
|
exports.createDomMotionComponent = createDomMotionComponent;
|
|
9887
9905
|
exports.createMotionComponent = createMotionComponent;
|
|
9906
|
+
exports.cubicBezier = cubicBezier;
|
|
9888
9907
|
exports.delay = delay;
|
|
9889
9908
|
exports.distance = distance;
|
|
9890
9909
|
exports.distance2D = distance2D;
|
|
9891
9910
|
exports.domAnimation = domAnimation;
|
|
9892
9911
|
exports.domMax = domMax;
|
|
9912
|
+
exports.easeIn = easeIn;
|
|
9913
|
+
exports.easeInOut = easeInOut;
|
|
9914
|
+
exports.easeOut = easeOut;
|
|
9893
9915
|
exports.filterProps = filterProps;
|
|
9894
9916
|
exports.isBrowser = isBrowser;
|
|
9895
9917
|
exports.isDragActive = isDragActive;
|
|
@@ -9,12 +9,7 @@ import { getDefaultTransition } from './utils/default-transitions.mjs';
|
|
|
9
9
|
import { isAnimatable } from './utils/is-animatable.mjs';
|
|
10
10
|
import { getKeyframes } from './utils/keyframes.mjs';
|
|
11
11
|
import { getValueTransition, isTransitionDefined } from './utils/transitions.mjs';
|
|
12
|
-
import { supports } from './waapi/supports.mjs';
|
|
13
12
|
|
|
14
|
-
/**
|
|
15
|
-
* A list of values that can be hardware-accelerated.
|
|
16
|
-
*/
|
|
17
|
-
const acceleratedValues = new Set(["opacity"]);
|
|
18
13
|
const createMotionValueAnimation = (valueName, value, target, transition = {}) => {
|
|
19
14
|
return (onComplete) => {
|
|
20
15
|
const valueTransition = getValueTransition(transition, valueName) || {};
|
|
@@ -96,27 +91,21 @@ const createMotionValueAnimation = (valueName, value, target, transition = {}) =
|
|
|
96
91
|
}
|
|
97
92
|
const visualElement = value.owner;
|
|
98
93
|
const element = visualElement && visualElement.current;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
options.damping !== 0 &&
|
|
104
|
-
visualElement &&
|
|
94
|
+
/**
|
|
95
|
+
* Animate via WAAPI if possible.
|
|
96
|
+
*/
|
|
97
|
+
if (visualElement &&
|
|
105
98
|
element instanceof HTMLElement &&
|
|
106
|
-
!visualElement.getProps().onUpdate
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
*/
|
|
111
|
-
return createAcceleratedAnimation(value, valueName, options);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
/**
|
|
115
|
-
* Otherwise, fall back to the main thread.
|
|
116
|
-
*/
|
|
117
|
-
const animation = animate(options);
|
|
118
|
-
return () => animation.stop();
|
|
99
|
+
!(visualElement === null || visualElement === void 0 ? void 0 : visualElement.getProps().onUpdate)) {
|
|
100
|
+
const acceleratedAnimation = createAcceleratedAnimation(value, valueName, options);
|
|
101
|
+
if (acceleratedAnimation)
|
|
102
|
+
return acceleratedAnimation;
|
|
119
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* If we didn't create an accelerated animation, create a JS animation
|
|
106
|
+
*/
|
|
107
|
+
const animation = animate(options);
|
|
108
|
+
return () => animation.stop();
|
|
120
109
|
};
|
|
121
110
|
};
|
|
122
111
|
|
|
@@ -2,8 +2,13 @@ import { sync } from '../../frameloop/index.mjs';
|
|
|
2
2
|
import { animate } from '../legacy-popmotion/index.mjs';
|
|
3
3
|
import { animateStyle } from './index.mjs';
|
|
4
4
|
import { isWaapiSupportedEasing } from './easing.mjs';
|
|
5
|
+
import { supports } from './supports.mjs';
|
|
5
6
|
import { getFinalKeyframe } from './utils/get-final-keyframe.mjs';
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A list of values that can be hardware-accelerated.
|
|
10
|
+
*/
|
|
11
|
+
const acceleratedValues = new Set(["opacity"]);
|
|
7
12
|
/**
|
|
8
13
|
* 10ms is chosen here as it strikes a balance between smooth
|
|
9
14
|
* results (more than one keyframe per frame at 60fps) and
|
|
@@ -11,16 +16,33 @@ import { getFinalKeyframe } from './utils/get-final-keyframe.mjs';
|
|
|
11
16
|
*/
|
|
12
17
|
const sampleDelta = 10; //ms
|
|
13
18
|
function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ...options }) {
|
|
19
|
+
const canAccelerateAnimation = supports.waapi() &&
|
|
20
|
+
acceleratedValues.has(valueName) &&
|
|
21
|
+
!options.repeatDelay &&
|
|
22
|
+
options.repeatType !== "mirror" &&
|
|
23
|
+
options.damping !== 0;
|
|
24
|
+
if (!canAccelerateAnimation)
|
|
25
|
+
return false;
|
|
14
26
|
let { keyframes, duration = 300, elapsed = 0, ease } = options;
|
|
15
27
|
/**
|
|
16
28
|
* If this animation needs pre-generated keyframes then generate.
|
|
17
29
|
*/
|
|
18
30
|
if (options.type === "spring" || !isWaapiSupportedEasing(options.ease)) {
|
|
31
|
+
/**
|
|
32
|
+
* If we need to pre-generate keyframes and repeat is infinite then
|
|
33
|
+
* early return as this will lock the thread.
|
|
34
|
+
*/
|
|
35
|
+
if (options.repeat === Infinity)
|
|
36
|
+
return;
|
|
19
37
|
const sampleAnimation = animate(options);
|
|
20
38
|
let state = { done: false, value: keyframes[0] };
|
|
21
39
|
const pregeneratedKeyframes = [];
|
|
40
|
+
/**
|
|
41
|
+
* Bail after 20 seconds of pre-generated keyframes as it's likely
|
|
42
|
+
* we're heading for an infinite loop.
|
|
43
|
+
*/
|
|
22
44
|
let t = 0;
|
|
23
|
-
while (!state.done) {
|
|
45
|
+
while (!state.done && t < 20000) {
|
|
24
46
|
state = sampleAnimation.sample(t);
|
|
25
47
|
pregeneratedKeyframes.push(state.value);
|
|
26
48
|
t += sampleDelta;
|
package/dist/es/index.mjs
CHANGED
|
@@ -59,6 +59,11 @@ export { PresenceContext } from './context/PresenceContext.mjs';
|
|
|
59
59
|
export { LayoutGroupContext } from './context/LayoutGroupContext.mjs';
|
|
60
60
|
export { DeprecatedLayoutGroupContext } from './context/DeprecatedLayoutGroupContext.mjs';
|
|
61
61
|
export { SwitchLayoutGroupContext } from './context/SwitchLayoutGroupContext.mjs';
|
|
62
|
+
export { anticipate } from './easing/anticipate.mjs';
|
|
63
|
+
export { backIn, backInOut, backOut } from './easing/back.mjs';
|
|
64
|
+
export { circIn, circInOut, circOut } from './easing/circ.mjs';
|
|
65
|
+
export { easeIn, easeInOut, easeOut } from './easing/ease.mjs';
|
|
66
|
+
export { cubicBezier } from './easing/cubic-bezier.mjs';
|
|
62
67
|
export { FlatTree } from './render/utils/flat-tree.mjs';
|
|
63
68
|
export { useAnimatedState as useDeprecatedAnimatedState } from './animation/hooks/use-animated-state.mjs';
|
|
64
69
|
export { useInvertedScale as useDeprecatedInvertedScale } from './value/use-inverted-scale.mjs';
|
|
@@ -22,7 +22,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
22
22
|
* and warn against mismatches.
|
|
23
23
|
*/
|
|
24
24
|
if (process.env.NODE_ENV === "development") {
|
|
25
|
-
warnOnce(nextValue.version === "8.
|
|
25
|
+
warnOnce(nextValue.version === "8.2.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.2.0 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -25,7 +25,7 @@ class MotionValue {
|
|
|
25
25
|
* This will be replaced by the build step with the latest version number.
|
|
26
26
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
27
27
|
*/
|
|
28
|
-
this.version = "8.
|
|
28
|
+
this.version = "8.2.0";
|
|
29
29
|
/**
|
|
30
30
|
* Duration, in milliseconds, since last updating frame.
|
|
31
31
|
*
|
|
@@ -2053,7 +2053,7 @@
|
|
|
2053
2053
|
* This will be replaced by the build step with the latest version number.
|
|
2054
2054
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2055
2055
|
*/
|
|
2056
|
-
this.version = "8.
|
|
2056
|
+
this.version = "8.2.0";
|
|
2057
2057
|
/**
|
|
2058
2058
|
* Duration, in milliseconds, since last updating frame.
|
|
2059
2059
|
*
|
|
@@ -3626,6 +3626,22 @@
|
|
|
3626
3626
|
});
|
|
3627
3627
|
}
|
|
3628
3628
|
|
|
3629
|
+
const featureTests = {
|
|
3630
|
+
waapi: () => Object.hasOwnProperty.call(Element.prototype, "animate"),
|
|
3631
|
+
};
|
|
3632
|
+
const results = {};
|
|
3633
|
+
const supports = {};
|
|
3634
|
+
/**
|
|
3635
|
+
* Generate features tests that cache their results.
|
|
3636
|
+
*/
|
|
3637
|
+
for (const key in featureTests) {
|
|
3638
|
+
supports[key] = () => {
|
|
3639
|
+
if (results[key] === undefined)
|
|
3640
|
+
results[key] = featureTests[key]();
|
|
3641
|
+
return results[key];
|
|
3642
|
+
};
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3629
3645
|
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }) {
|
|
3630
3646
|
const index = repeat && repeatType !== "loop" && repeat % 2 === 1
|
|
3631
3647
|
? 0
|
|
@@ -3633,6 +3649,10 @@
|
|
|
3633
3649
|
return keyframes[index];
|
|
3634
3650
|
}
|
|
3635
3651
|
|
|
3652
|
+
/**
|
|
3653
|
+
* A list of values that can be hardware-accelerated.
|
|
3654
|
+
*/
|
|
3655
|
+
const acceleratedValues = new Set(["opacity"]);
|
|
3636
3656
|
/**
|
|
3637
3657
|
* 10ms is chosen here as it strikes a balance between smooth
|
|
3638
3658
|
* results (more than one keyframe per frame at 60fps) and
|
|
@@ -3640,16 +3660,33 @@
|
|
|
3640
3660
|
*/
|
|
3641
3661
|
const sampleDelta = 10; //ms
|
|
3642
3662
|
function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ...options }) {
|
|
3663
|
+
const canAccelerateAnimation = supports.waapi() &&
|
|
3664
|
+
acceleratedValues.has(valueName) &&
|
|
3665
|
+
!options.repeatDelay &&
|
|
3666
|
+
options.repeatType !== "mirror" &&
|
|
3667
|
+
options.damping !== 0;
|
|
3668
|
+
if (!canAccelerateAnimation)
|
|
3669
|
+
return false;
|
|
3643
3670
|
let { keyframes, duration = 300, elapsed = 0, ease } = options;
|
|
3644
3671
|
/**
|
|
3645
3672
|
* If this animation needs pre-generated keyframes then generate.
|
|
3646
3673
|
*/
|
|
3647
3674
|
if (options.type === "spring" || !isWaapiSupportedEasing(options.ease)) {
|
|
3675
|
+
/**
|
|
3676
|
+
* If we need to pre-generate keyframes and repeat is infinite then
|
|
3677
|
+
* early return as this will lock the thread.
|
|
3678
|
+
*/
|
|
3679
|
+
if (options.repeat === Infinity)
|
|
3680
|
+
return;
|
|
3648
3681
|
const sampleAnimation = animate$1(options);
|
|
3649
3682
|
let state = { done: false, value: keyframes[0] };
|
|
3650
3683
|
const pregeneratedKeyframes = [];
|
|
3684
|
+
/**
|
|
3685
|
+
* Bail after 20 seconds of pre-generated keyframes as it's likely
|
|
3686
|
+
* we're heading for an infinite loop.
|
|
3687
|
+
*/
|
|
3651
3688
|
let t = 0;
|
|
3652
|
-
while (!state.done) {
|
|
3689
|
+
while (!state.done && t < 20000) {
|
|
3653
3690
|
state = sampleAnimation.sample(t);
|
|
3654
3691
|
pregeneratedKeyframes.push(state.value);
|
|
3655
3692
|
t += sampleDelta;
|
|
@@ -3949,26 +3986,6 @@
|
|
|
3949
3986
|
}
|
|
3950
3987
|
}
|
|
3951
3988
|
|
|
3952
|
-
const featureTests = {
|
|
3953
|
-
waapi: () => Object.hasOwnProperty.call(Element.prototype, "animate"),
|
|
3954
|
-
};
|
|
3955
|
-
const results = {};
|
|
3956
|
-
const supports = {};
|
|
3957
|
-
/**
|
|
3958
|
-
* Generate features tests that cache their results.
|
|
3959
|
-
*/
|
|
3960
|
-
for (const key in featureTests) {
|
|
3961
|
-
supports[key] = () => {
|
|
3962
|
-
if (results[key] === undefined)
|
|
3963
|
-
results[key] = featureTests[key]();
|
|
3964
|
-
return results[key];
|
|
3965
|
-
};
|
|
3966
|
-
}
|
|
3967
|
-
|
|
3968
|
-
/**
|
|
3969
|
-
* A list of values that can be hardware-accelerated.
|
|
3970
|
-
*/
|
|
3971
|
-
const acceleratedValues = new Set(["opacity"]);
|
|
3972
3989
|
const createMotionValueAnimation = (valueName, value, target, transition = {}) => {
|
|
3973
3990
|
return (onComplete) => {
|
|
3974
3991
|
const valueTransition = getValueTransition(transition, valueName) || {};
|
|
@@ -4050,27 +4067,21 @@
|
|
|
4050
4067
|
}
|
|
4051
4068
|
const visualElement = value.owner;
|
|
4052
4069
|
const element = visualElement && visualElement.current;
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
options.damping !== 0 &&
|
|
4058
|
-
visualElement &&
|
|
4070
|
+
/**
|
|
4071
|
+
* Animate via WAAPI if possible.
|
|
4072
|
+
*/
|
|
4073
|
+
if (visualElement &&
|
|
4059
4074
|
element instanceof HTMLElement &&
|
|
4060
|
-
!visualElement.getProps().onUpdate
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
*/
|
|
4065
|
-
return createAcceleratedAnimation(value, valueName, options);
|
|
4066
|
-
}
|
|
4067
|
-
else {
|
|
4068
|
-
/**
|
|
4069
|
-
* Otherwise, fall back to the main thread.
|
|
4070
|
-
*/
|
|
4071
|
-
const animation = animate$1(options);
|
|
4072
|
-
return () => animation.stop();
|
|
4075
|
+
!(visualElement === null || visualElement === void 0 ? void 0 : visualElement.getProps().onUpdate)) {
|
|
4076
|
+
const acceleratedAnimation = createAcceleratedAnimation(value, valueName, options);
|
|
4077
|
+
if (acceleratedAnimation)
|
|
4078
|
+
return acceleratedAnimation;
|
|
4073
4079
|
}
|
|
4080
|
+
/**
|
|
4081
|
+
* If we didn't create an accelerated animation, create a JS animation
|
|
4082
|
+
*/
|
|
4083
|
+
const animation = animate$1(options);
|
|
4084
|
+
return () => animation.stop();
|
|
4074
4085
|
};
|
|
4075
4086
|
};
|
|
4076
4087
|
|
|
@@ -5913,7 +5924,7 @@
|
|
|
5913
5924
|
* and warn against mismatches.
|
|
5914
5925
|
*/
|
|
5915
5926
|
{
|
|
5916
|
-
warnOnce(nextValue.version === "8.
|
|
5927
|
+
warnOnce(nextValue.version === "8.2.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.2.0 may not work as expected.`);
|
|
5917
5928
|
}
|
|
5918
5929
|
}
|
|
5919
5930
|
else if (isMotionValue(prevValue)) {
|
|
@@ -10497,18 +10508,29 @@
|
|
|
10497
10508
|
exports.animateVisualElement = animateVisualElement;
|
|
10498
10509
|
exports.animationControls = animationControls;
|
|
10499
10510
|
exports.animations = animations;
|
|
10511
|
+
exports.anticipate = anticipate;
|
|
10512
|
+
exports.backIn = backIn;
|
|
10513
|
+
exports.backInOut = backInOut;
|
|
10514
|
+
exports.backOut = backOut;
|
|
10500
10515
|
exports.buildTransform = buildTransform;
|
|
10501
10516
|
exports.calcLength = calcLength;
|
|
10502
10517
|
exports.checkTargetForNewValues = checkTargetForNewValues;
|
|
10518
|
+
exports.circIn = circIn;
|
|
10519
|
+
exports.circInOut = circInOut;
|
|
10520
|
+
exports.circOut = circOut;
|
|
10503
10521
|
exports.clamp = clamp$1;
|
|
10504
10522
|
exports.createBox = createBox;
|
|
10505
10523
|
exports.createDomMotionComponent = createDomMotionComponent;
|
|
10506
10524
|
exports.createMotionComponent = createMotionComponent;
|
|
10525
|
+
exports.cubicBezier = cubicBezier;
|
|
10507
10526
|
exports.delay = delay;
|
|
10508
10527
|
exports.distance = distance;
|
|
10509
10528
|
exports.distance2D = distance2D;
|
|
10510
10529
|
exports.domAnimation = domAnimation;
|
|
10511
10530
|
exports.domMax = domMax;
|
|
10531
|
+
exports.easeIn = easeIn;
|
|
10532
|
+
exports.easeInOut = easeInOut;
|
|
10533
|
+
exports.easeOut = easeOut;
|
|
10512
10534
|
exports.filterProps = filterProps;
|
|
10513
10535
|
exports.isBrowser = isBrowser;
|
|
10514
10536
|
exports.isDragActive = isDragActive;
|