framer-motion 10.0.0-alpha.1 → 10.0.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 +18 -7
- package/dist/es/animation/legacy-popmotion/index.mjs +11 -1
- package/dist/es/animation/waapi/create-accelerated-animation.mjs +5 -4
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +18 -7
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/projection.dev.js +18 -7
- 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
|
@@ -1987,7 +1987,7 @@ class MotionValue {
|
|
|
1987
1987
|
* This will be replaced by the build step with the latest version number.
|
|
1988
1988
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
1989
1989
|
*/
|
|
1990
|
-
this.version = "10.0.
|
|
1990
|
+
this.version = "10.0.1";
|
|
1991
1991
|
/**
|
|
1992
1992
|
* Duration, in milliseconds, since last updating frame.
|
|
1993
1993
|
*
|
|
@@ -3519,9 +3519,19 @@ function animateValue({ duration, driver = framesync, elapsed = 0, repeat: repea
|
|
|
3519
3519
|
* animate() can't yet be sampled for time, instead it
|
|
3520
3520
|
* consumes time. So to sample it we have to run a low
|
|
3521
3521
|
* temporal-resolution version.
|
|
3522
|
+
*
|
|
3523
|
+
* isControlled should be set to true if sample is being run within
|
|
3524
|
+
* a loop. This indicates that we're not arbitrarily sampling
|
|
3525
|
+
* the animation but running it one step after another. Therefore
|
|
3526
|
+
* we don't need to run a low-res version here. This is a stop-gap
|
|
3527
|
+
* until a rewrite can sample for time.
|
|
3522
3528
|
*/
|
|
3523
|
-
sample: (t) => {
|
|
3529
|
+
sample: (t, isControlled = false) => {
|
|
3524
3530
|
elapsed = initialElapsed;
|
|
3531
|
+
if (isControlled) {
|
|
3532
|
+
update(t);
|
|
3533
|
+
return state;
|
|
3534
|
+
}
|
|
3525
3535
|
const sampleResolution = duration && typeof duration === "number"
|
|
3526
3536
|
? Math.max(duration * 0.5, 50)
|
|
3527
3537
|
: 50;
|
|
@@ -3612,6 +3622,9 @@ const acceleratedValues = new Set([
|
|
|
3612
3622
|
* keyframe quantity.
|
|
3613
3623
|
*/
|
|
3614
3624
|
const sampleDelta = 10; //ms
|
|
3625
|
+
const requiresPregeneratedKeyframes = (valueName, options) => options.type === "spring" ||
|
|
3626
|
+
valueName === "backgroundColor" ||
|
|
3627
|
+
!isWaapiSupportedEasing(options.ease);
|
|
3615
3628
|
function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ...options }) {
|
|
3616
3629
|
const canAccelerateAnimation = supports.waapi() &&
|
|
3617
3630
|
acceleratedValues.has(valueName) &&
|
|
@@ -3624,9 +3637,7 @@ function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ..
|
|
|
3624
3637
|
/**
|
|
3625
3638
|
* If this animation needs pre-generated keyframes then generate.
|
|
3626
3639
|
*/
|
|
3627
|
-
if (options
|
|
3628
|
-
valueName === "backgroundColor" ||
|
|
3629
|
-
!isWaapiSupportedEasing(options.ease)) {
|
|
3640
|
+
if (requiresPregeneratedKeyframes(valueName, options)) {
|
|
3630
3641
|
const sampleAnimation = animateValue({
|
|
3631
3642
|
...options,
|
|
3632
3643
|
repeat: 0,
|
|
@@ -3640,7 +3651,7 @@ function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ..
|
|
|
3640
3651
|
*/
|
|
3641
3652
|
let t = 0;
|
|
3642
3653
|
while (!state.done && t < 20000) {
|
|
3643
|
-
state = sampleAnimation.sample(t);
|
|
3654
|
+
state = sampleAnimation.sample(t, true);
|
|
3644
3655
|
pregeneratedKeyframes.push(state.value);
|
|
3645
3656
|
t += sampleDelta;
|
|
3646
3657
|
}
|
|
@@ -7829,7 +7840,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
7829
7840
|
* and warn against mismatches.
|
|
7830
7841
|
*/
|
|
7831
7842
|
if (process.env.NODE_ENV === "development") {
|
|
7832
|
-
warnOnce(nextValue.version === "10.0.
|
|
7843
|
+
warnOnce(nextValue.version === "10.0.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.0.1 may not work as expected.`);
|
|
7833
7844
|
}
|
|
7834
7845
|
}
|
|
7835
7846
|
else if (isMotionValue(prevValue)) {
|
|
@@ -132,9 +132,19 @@ function animateValue({ duration, driver = framesync, elapsed = 0, repeat: repea
|
|
|
132
132
|
* animate() can't yet be sampled for time, instead it
|
|
133
133
|
* consumes time. So to sample it we have to run a low
|
|
134
134
|
* temporal-resolution version.
|
|
135
|
+
*
|
|
136
|
+
* isControlled should be set to true if sample is being run within
|
|
137
|
+
* a loop. This indicates that we're not arbitrarily sampling
|
|
138
|
+
* the animation but running it one step after another. Therefore
|
|
139
|
+
* we don't need to run a low-res version here. This is a stop-gap
|
|
140
|
+
* until a rewrite can sample for time.
|
|
135
141
|
*/
|
|
136
|
-
sample: (t) => {
|
|
142
|
+
sample: (t, isControlled = false) => {
|
|
137
143
|
elapsed = initialElapsed;
|
|
144
|
+
if (isControlled) {
|
|
145
|
+
update(t);
|
|
146
|
+
return state;
|
|
147
|
+
}
|
|
138
148
|
const sampleResolution = duration && typeof duration === "number"
|
|
139
149
|
? Math.max(duration * 0.5, 50)
|
|
140
150
|
: 50;
|
|
@@ -21,6 +21,9 @@ const acceleratedValues = new Set([
|
|
|
21
21
|
* keyframe quantity.
|
|
22
22
|
*/
|
|
23
23
|
const sampleDelta = 10; //ms
|
|
24
|
+
const requiresPregeneratedKeyframes = (valueName, options) => options.type === "spring" ||
|
|
25
|
+
valueName === "backgroundColor" ||
|
|
26
|
+
!isWaapiSupportedEasing(options.ease);
|
|
24
27
|
function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ...options }) {
|
|
25
28
|
const canAccelerateAnimation = supports.waapi() &&
|
|
26
29
|
acceleratedValues.has(valueName) &&
|
|
@@ -33,9 +36,7 @@ function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ..
|
|
|
33
36
|
/**
|
|
34
37
|
* If this animation needs pre-generated keyframes then generate.
|
|
35
38
|
*/
|
|
36
|
-
if (options
|
|
37
|
-
valueName === "backgroundColor" ||
|
|
38
|
-
!isWaapiSupportedEasing(options.ease)) {
|
|
39
|
+
if (requiresPregeneratedKeyframes(valueName, options)) {
|
|
39
40
|
const sampleAnimation = animateValue({
|
|
40
41
|
...options,
|
|
41
42
|
repeat: 0,
|
|
@@ -49,7 +50,7 @@ function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ..
|
|
|
49
50
|
*/
|
|
50
51
|
let t = 0;
|
|
51
52
|
while (!state.done && t < 20000) {
|
|
52
|
-
state = sampleAnimation.sample(t);
|
|
53
|
+
state = sampleAnimation.sample(t, true);
|
|
53
54
|
pregeneratedKeyframes.push(state.value);
|
|
54
55
|
t += sampleDelta;
|
|
55
56
|
}
|
|
@@ -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 === "10.0.
|
|
25
|
+
warnOnce(nextValue.version === "10.0.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.0.1 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ class MotionValue {
|
|
|
26
26
|
* This will be replaced by the build step with the latest version number.
|
|
27
27
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
28
28
|
*/
|
|
29
|
-
this.version = "10.0.
|
|
29
|
+
this.version = "10.0.1";
|
|
30
30
|
/**
|
|
31
31
|
* Duration, in milliseconds, since last updating frame.
|
|
32
32
|
*
|
|
@@ -1987,7 +1987,7 @@
|
|
|
1987
1987
|
* This will be replaced by the build step with the latest version number.
|
|
1988
1988
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
1989
1989
|
*/
|
|
1990
|
-
this.version = "10.0.
|
|
1990
|
+
this.version = "10.0.1";
|
|
1991
1991
|
/**
|
|
1992
1992
|
* Duration, in milliseconds, since last updating frame.
|
|
1993
1993
|
*
|
|
@@ -3519,9 +3519,19 @@
|
|
|
3519
3519
|
* animate() can't yet be sampled for time, instead it
|
|
3520
3520
|
* consumes time. So to sample it we have to run a low
|
|
3521
3521
|
* temporal-resolution version.
|
|
3522
|
+
*
|
|
3523
|
+
* isControlled should be set to true if sample is being run within
|
|
3524
|
+
* a loop. This indicates that we're not arbitrarily sampling
|
|
3525
|
+
* the animation but running it one step after another. Therefore
|
|
3526
|
+
* we don't need to run a low-res version here. This is a stop-gap
|
|
3527
|
+
* until a rewrite can sample for time.
|
|
3522
3528
|
*/
|
|
3523
|
-
sample: (t) => {
|
|
3529
|
+
sample: (t, isControlled = false) => {
|
|
3524
3530
|
elapsed = initialElapsed;
|
|
3531
|
+
if (isControlled) {
|
|
3532
|
+
update(t);
|
|
3533
|
+
return state;
|
|
3534
|
+
}
|
|
3525
3535
|
const sampleResolution = duration && typeof duration === "number"
|
|
3526
3536
|
? Math.max(duration * 0.5, 50)
|
|
3527
3537
|
: 50;
|
|
@@ -3612,6 +3622,9 @@
|
|
|
3612
3622
|
* keyframe quantity.
|
|
3613
3623
|
*/
|
|
3614
3624
|
const sampleDelta = 10; //ms
|
|
3625
|
+
const requiresPregeneratedKeyframes = (valueName, options) => options.type === "spring" ||
|
|
3626
|
+
valueName === "backgroundColor" ||
|
|
3627
|
+
!isWaapiSupportedEasing(options.ease);
|
|
3615
3628
|
function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ...options }) {
|
|
3616
3629
|
const canAccelerateAnimation = supports.waapi() &&
|
|
3617
3630
|
acceleratedValues.has(valueName) &&
|
|
@@ -3624,9 +3637,7 @@
|
|
|
3624
3637
|
/**
|
|
3625
3638
|
* If this animation needs pre-generated keyframes then generate.
|
|
3626
3639
|
*/
|
|
3627
|
-
if (options
|
|
3628
|
-
valueName === "backgroundColor" ||
|
|
3629
|
-
!isWaapiSupportedEasing(options.ease)) {
|
|
3640
|
+
if (requiresPregeneratedKeyframes(valueName, options)) {
|
|
3630
3641
|
const sampleAnimation = animateValue({
|
|
3631
3642
|
...options,
|
|
3632
3643
|
repeat: 0,
|
|
@@ -3640,7 +3651,7 @@
|
|
|
3640
3651
|
*/
|
|
3641
3652
|
let t = 0;
|
|
3642
3653
|
while (!state.done && t < 20000) {
|
|
3643
|
-
state = sampleAnimation.sample(t);
|
|
3654
|
+
state = sampleAnimation.sample(t, true);
|
|
3644
3655
|
pregeneratedKeyframes.push(state.value);
|
|
3645
3656
|
t += sampleDelta;
|
|
3646
3657
|
}
|
|
@@ -7829,7 +7840,7 @@
|
|
|
7829
7840
|
* and warn against mismatches.
|
|
7830
7841
|
*/
|
|
7831
7842
|
{
|
|
7832
|
-
warnOnce(nextValue.version === "10.0.
|
|
7843
|
+
warnOnce(nextValue.version === "10.0.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.0.1 may not work as expected.`);
|
|
7833
7844
|
}
|
|
7834
7845
|
}
|
|
7835
7846
|
else if (isMotionValue(prevValue)) {
|