motion 11.11.16 → 11.12.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/.turbo/turbo-build.log +15 -17
- package/README.md +16 -3
- package/dist/cjs/index.js +129 -75
- package/dist/cjs/mini.js +4 -4
- package/dist/cjs/react-client.js +127 -74
- package/dist/cjs/react-mini.js +4 -4
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +1 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +1 -1
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/linear.mjs +2 -3
- package/dist/es/framer-motion/dist/es/animation/generators/spring/defaults.mjs +27 -0
- package/dist/es/framer-motion/dist/es/animation/generators/spring/find.mjs +8 -11
- package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +53 -17
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/framer-motion/dist/es/value/index.mjs +1 -1
- package/dist/motion.dev.js +129 -75
- package/dist/motion.js +1 -1
- package/package.json +3 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,47 +1,45 @@
|
|
|
1
|
-
(node:75899) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
|
|
2
|
-
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
3
1
|
[36m
|
|
4
2
|
[1mlib/index.js[22m → [1mdist/motion.dev.js[22m...[39m
|
|
5
|
-
[32mcreated [1mdist/motion.dev.js[22m in [
|
|
3
|
+
[32mcreated [1mdist/motion.dev.js[22m in [1m737ms[22m[39m
|
|
6
4
|
[36m
|
|
7
5
|
[1mlib/index.js[22m → [1mdist/motion.js[22m...[39m
|
|
8
|
-
[32mcreated [1mdist/motion.js[22m in [
|
|
6
|
+
[32mcreated [1mdist/motion.js[22m in [1m825ms[22m[39m
|
|
9
7
|
[36m
|
|
10
8
|
[1mlib/index.js[22m → [1mdist/cjs[22m...[39m
|
|
11
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
9
|
+
[32mcreated [1mdist/cjs[22m in [1m227ms[22m[39m
|
|
12
10
|
[36m
|
|
13
11
|
[1mlib/react-client.js[22m → [1mdist/cjs[22m...[39m
|
|
14
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
12
|
+
[32mcreated [1mdist/cjs[22m in [1m271ms[22m[39m
|
|
15
13
|
[36m
|
|
16
14
|
[1mlib/react.js[22m → [1mdist/cjs[22m...[39m
|
|
17
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
15
|
+
[32mcreated [1mdist/cjs[22m in [1m3ms[22m[39m
|
|
18
16
|
[36m
|
|
19
17
|
[1mlib/mini.js[22m → [1mdist/cjs[22m...[39m
|
|
20
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
18
|
+
[32mcreated [1mdist/cjs[22m in [1m24ms[22m[39m
|
|
21
19
|
[36m
|
|
22
20
|
[1mlib/react-mini.js[22m → [1mdist/cjs[22m...[39m
|
|
23
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
21
|
+
[32mcreated [1mdist/cjs[22m in [1m34ms[22m[39m
|
|
24
22
|
[36m
|
|
25
23
|
[1mlib/react-m.js[22m → [1mdist/cjs[22m...[39m
|
|
26
|
-
[32mcreated [1mdist/cjs[22m in [
|
|
24
|
+
[32mcreated [1mdist/cjs[22m in [1m70ms[22m[39m
|
|
27
25
|
[36m
|
|
28
26
|
[1mlib/index.js, lib/mini.js, lib/react.js, lib/react-mini.js, lib/react-client.js, lib/react-m.js[22m → [1mdist/es[22m...[39m
|
|
29
|
-
[32mcreated [1mdist/es[22m in [
|
|
27
|
+
[32mcreated [1mdist/es[22m in [1m636ms[22m[39m
|
|
30
28
|
[36m
|
|
31
29
|
[1mtypes/index.d.ts[22m → [1mdist/index.d.ts[22m...[39m
|
|
32
|
-
[32mcreated [1mdist/index.d.ts[22m in [
|
|
30
|
+
[32mcreated [1mdist/index.d.ts[22m in [1m21ms[22m[39m
|
|
33
31
|
[36m
|
|
34
32
|
[1mtypes/react.d.ts[22m → [1mdist/react.d.ts[22m...[39m
|
|
35
|
-
[32mcreated [1mdist/react.d.ts[22m in [
|
|
33
|
+
[32mcreated [1mdist/react.d.ts[22m in [1m13ms[22m[39m
|
|
36
34
|
[36m
|
|
37
35
|
[1mtypes/react-mini.d.ts[22m → [1mdist/react-mini.d.ts[22m...[39m
|
|
38
|
-
[32mcreated [1mdist/react-mini.d.ts[22m in [
|
|
36
|
+
[32mcreated [1mdist/react-mini.d.ts[22m in [1m12ms[22m[39m
|
|
39
37
|
[36m
|
|
40
38
|
[1mtypes/react-m.d.ts[22m → [1mdist/react-m.d.ts[22m...[39m
|
|
41
|
-
[32mcreated [1mdist/react-m.d.ts[22m in [
|
|
39
|
+
[32mcreated [1mdist/react-m.d.ts[22m in [1m58ms[22m[39m
|
|
42
40
|
[36m
|
|
43
41
|
[1mtypes/mini.d.ts[22m → [1mdist/mini.d.ts[22m...[39m
|
|
44
|
-
[32mcreated [1mdist/mini.d.ts[22m in [
|
|
42
|
+
[32mcreated [1mdist/mini.d.ts[22m in [1m13ms[22m[39m
|
|
45
43
|
[36m
|
|
46
44
|
[1mtypes/react-client.d.ts[22m → [1mdist/react-client.d.ts[22m...[39m
|
|
47
|
-
[32mcreated [1mdist/react-client.d.ts[22m in [
|
|
45
|
+
[32mcreated [1mdist/react-client.d.ts[22m in [1m6ms[22m[39m
|
package/README.md
CHANGED
|
@@ -38,14 +38,14 @@ It does all this:
|
|
|
38
38
|
|
|
39
39
|
- [Springs](https://motion.dev/docs/react-transitions#spring)
|
|
40
40
|
- [Keyframes](https://motion.dev/docs/react-animation#keyframes)
|
|
41
|
-
- [Layout animations](https://motion
|
|
41
|
+
- [Layout animations](https://motion.dev/docs/react-layout-animations)
|
|
42
42
|
- [Shared layout animations](https://motion.dev/docs/react-layout-animations#shared-layout-animations)
|
|
43
43
|
- [Gestures (drag/tap/hover)](https://motion.dev/docs/react-gestures)
|
|
44
44
|
- [Scroll animations](https://motion.dev/docs/react-scroll-animations)
|
|
45
45
|
- [SVG paths](https://motion.dev/docs/react-animation#svg-line-drawing)
|
|
46
46
|
- [Exit animations](https://motion.dev/docs/react-animation#exit-animations)
|
|
47
|
-
- [Server-side rendering](https://motion.dev
|
|
48
|
-
- [Independent transforms](https://motion.dev/docs/react-motion-component#
|
|
47
|
+
- [Server-side rendering](https://motion.dev/docs/react-motion-component#server-side-rendering)
|
|
48
|
+
- [Independent transforms](https://motion.dev/docs/react-motion-component#style)
|
|
49
49
|
- [Orchestrate animations across components](https://motion.dev/docs/react-animation#orchestration)
|
|
50
50
|
- [CSS variables](https://motion.dev/docs/react-animation#css-variables)
|
|
51
51
|
|
|
@@ -101,6 +101,10 @@ Motion powers Framer animations, the web builder for creative pros. Design and s
|
|
|
101
101
|
|
|
102
102
|
<a href="https://linear.app"><img alt="Linear" src="https://github.com/user-attachments/assets/a93710bb-d8ed-40e3-b0fb-1c5b3e2b16bb" width="300px" height="200px"></a>
|
|
103
103
|
|
|
104
|
+
### Gold
|
|
105
|
+
|
|
106
|
+
<a href="https://liveblocks.io"><img alt="Liveblocks" src="https://github.com/user-attachments/assets/31436a47-951e-4eab-9a68-bdd54ccf9444" width="225px" height="150px"></a>
|
|
107
|
+
|
|
104
108
|
### Silver
|
|
105
109
|
|
|
106
110
|
<a href="https://www.frontend.fyi/?utm_source=motion"><img alt="Frontend.fyi" src="https://github.com/user-attachments/assets/07d23aa5-69db-44a0-849d-90177e6fc817" width="150px" height="100px"></a>
|
|
@@ -109,7 +113,16 @@ Motion powers Framer animations, the web builder for creative pros. Design and s
|
|
|
109
113
|
|
|
110
114
|
<a href="https://firecrawl.dev"><img alt="Firecrawl" src="https://github.com/user-attachments/assets/cba90e54-1329-4353-8fba-85beef4d2ee9" width="150px" height="100px"></a>
|
|
111
115
|
|
|
116
|
+
<a href="https://puzzmo.com"><img alt="Puzzmo" src="https://github.com/user-attachments/assets/aa2d5586-e5e2-43b9-8446-db456e4b0758" width="150px" height="100px"></a>
|
|
117
|
+
|
|
118
|
+
<a href="https://buildui.com"><img alt="Build UI" src="https://github.com/user-attachments/assets/024bfcd5-50e8-4b3d-a115-d5c6d6030d1c" width="150px" height="100px"></a>
|
|
119
|
+
|
|
120
|
+
<a href="https://hover.dev"><img alt="Hover" src="https://github.com/user-attachments/assets/4715b555-d2ac-4cb7-9f35-d36d708827b3" width="150px" height="100px"></a>
|
|
121
|
+
|
|
112
122
|
### Personal
|
|
113
123
|
|
|
114
124
|
- [Nusu](https://x.com/nusualabuga)
|
|
115
125
|
- [OlegWock](https://sinja.io)
|
|
126
|
+
- [Lambert Weller](https://github.com/l-mbert)
|
|
127
|
+
- [Jake LeBoeuf](https://jklb.wf)
|
|
128
|
+
- [Han Lee](https://github.com/hahnlee)
|
package/dist/cjs/index.js
CHANGED
|
@@ -279,7 +279,7 @@ class MotionValue {
|
|
|
279
279
|
* This will be replaced by the build step with the latest version number.
|
|
280
280
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
281
281
|
*/
|
|
282
|
-
this.version = "11.
|
|
282
|
+
this.version = "11.12.0";
|
|
283
283
|
/**
|
|
284
284
|
* Tracks whether this value can output a velocity. Currently this is only true
|
|
285
285
|
* if the value is numerical, but we might be able to widen the scope here and support
|
|
@@ -647,6 +647,34 @@ class GroupPlaybackControls {
|
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
+
/*
|
|
651
|
+
Progress within given range
|
|
652
|
+
|
|
653
|
+
Given a lower limit and an upper limit, we return the progress
|
|
654
|
+
(expressed as a number 0-1) represented by the given value, and
|
|
655
|
+
limit that progress to within 0-1.
|
|
656
|
+
|
|
657
|
+
@param [number]: Lower limit
|
|
658
|
+
@param [number]: Upper limit
|
|
659
|
+
@param [number]: Value to find progress within given range
|
|
660
|
+
@return [number]: Progress of value within range as expressed 0-1
|
|
661
|
+
*/
|
|
662
|
+
const progress = (from, to, value) => {
|
|
663
|
+
const toFromDifference = to - from;
|
|
664
|
+
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
const generateLinearEasing = (easing, duration, // as milliseconds
|
|
668
|
+
resolution = 10 // as milliseconds
|
|
669
|
+
) => {
|
|
670
|
+
let points = "";
|
|
671
|
+
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
672
|
+
for (let i = 0; i < numPoints; i++) {
|
|
673
|
+
points += easing(progress(0, numPoints - 1, i)) + ", ";
|
|
674
|
+
}
|
|
675
|
+
return `linear(${points.substring(0, points.length - 2)})`;
|
|
676
|
+
};
|
|
677
|
+
|
|
650
678
|
/**
|
|
651
679
|
* Converts seconds to milliseconds
|
|
652
680
|
*
|
|
@@ -685,21 +713,43 @@ const clamp = (min, max, v) => {
|
|
|
685
713
|
return v;
|
|
686
714
|
};
|
|
687
715
|
|
|
716
|
+
const springDefaults = {
|
|
717
|
+
// Default spring physics
|
|
718
|
+
stiffness: 100,
|
|
719
|
+
damping: 10,
|
|
720
|
+
mass: 1.0,
|
|
721
|
+
velocity: 0.0,
|
|
722
|
+
// Default duration/bounce-based options
|
|
723
|
+
duration: 800, // in ms
|
|
724
|
+
bounce: 0.3,
|
|
725
|
+
visualDuration: 0.3, // in seconds
|
|
726
|
+
// Rest thresholds
|
|
727
|
+
restSpeed: {
|
|
728
|
+
granular: 0.01,
|
|
729
|
+
default: 2,
|
|
730
|
+
},
|
|
731
|
+
restDelta: {
|
|
732
|
+
granular: 0.005,
|
|
733
|
+
default: 0.5,
|
|
734
|
+
},
|
|
735
|
+
// Limits
|
|
736
|
+
minDuration: 0.01, // in seconds
|
|
737
|
+
maxDuration: 10.0, // in seconds
|
|
738
|
+
minDamping: 0.05,
|
|
739
|
+
maxDamping: 1,
|
|
740
|
+
};
|
|
741
|
+
|
|
688
742
|
const safeMin = 0.001;
|
|
689
|
-
|
|
690
|
-
const maxDuration$1 = 10.0;
|
|
691
|
-
const minDamping = 0.05;
|
|
692
|
-
const maxDamping = 1;
|
|
693
|
-
function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) {
|
|
743
|
+
function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass, }) {
|
|
694
744
|
let envelope;
|
|
695
745
|
let derivative;
|
|
696
|
-
exports.warning(duration <= secondsToMilliseconds(maxDuration
|
|
746
|
+
exports.warning(duration <= secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less");
|
|
697
747
|
let dampingRatio = 1 - bounce;
|
|
698
748
|
/**
|
|
699
749
|
* Restrict dampingRatio and duration to within acceptable ranges.
|
|
700
750
|
*/
|
|
701
|
-
dampingRatio = clamp(minDamping, maxDamping, dampingRatio);
|
|
702
|
-
duration = clamp(minDuration, maxDuration
|
|
751
|
+
dampingRatio = clamp(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio);
|
|
752
|
+
duration = clamp(springDefaults.minDuration, springDefaults.maxDuration, millisecondsToSeconds(duration));
|
|
703
753
|
if (dampingRatio < 1) {
|
|
704
754
|
/**
|
|
705
755
|
* Underdamped spring
|
|
@@ -743,8 +793,8 @@ function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, })
|
|
|
743
793
|
duration = secondsToMilliseconds(duration);
|
|
744
794
|
if (isNaN(undampedFreq)) {
|
|
745
795
|
return {
|
|
746
|
-
stiffness:
|
|
747
|
-
damping:
|
|
796
|
+
stiffness: springDefaults.stiffness,
|
|
797
|
+
damping: springDefaults.damping,
|
|
748
798
|
duration,
|
|
749
799
|
};
|
|
750
800
|
}
|
|
@@ -769,6 +819,22 @@ function calcAngularFreq(undampedFreq, dampingRatio) {
|
|
|
769
819
|
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
|
|
770
820
|
}
|
|
771
821
|
|
|
822
|
+
/**
|
|
823
|
+
* Implement a practical max duration for keyframe generation
|
|
824
|
+
* to prevent infinite loops
|
|
825
|
+
*/
|
|
826
|
+
const maxGeneratorDuration = 20000;
|
|
827
|
+
function calcGeneratorDuration(generator) {
|
|
828
|
+
let duration = 0;
|
|
829
|
+
const timeStep = 50;
|
|
830
|
+
let state = generator.next(duration);
|
|
831
|
+
while (!state.done && duration < maxGeneratorDuration) {
|
|
832
|
+
duration += timeStep;
|
|
833
|
+
state = generator.next(duration);
|
|
834
|
+
}
|
|
835
|
+
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
836
|
+
}
|
|
837
|
+
|
|
772
838
|
const durationKeys = ["duration", "bounce"];
|
|
773
839
|
const physicsKeys = ["stiffness", "damping", "mass"];
|
|
774
840
|
function isSpringType(options, keys) {
|
|
@@ -776,29 +842,51 @@ function isSpringType(options, keys) {
|
|
|
776
842
|
}
|
|
777
843
|
function getSpringOptions(options) {
|
|
778
844
|
let springOptions = {
|
|
779
|
-
velocity:
|
|
780
|
-
stiffness:
|
|
781
|
-
damping:
|
|
782
|
-
mass:
|
|
845
|
+
velocity: springDefaults.velocity,
|
|
846
|
+
stiffness: springDefaults.stiffness,
|
|
847
|
+
damping: springDefaults.damping,
|
|
848
|
+
mass: springDefaults.mass,
|
|
783
849
|
isResolvedFromDuration: false,
|
|
784
850
|
...options,
|
|
785
851
|
};
|
|
786
852
|
// stiffness/damping/mass overrides duration/bounce
|
|
787
853
|
if (!isSpringType(options, physicsKeys) &&
|
|
788
854
|
isSpringType(options, durationKeys)) {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
855
|
+
if (options.visualDuration) {
|
|
856
|
+
const visualDuration = options.visualDuration;
|
|
857
|
+
const root = (2 * Math.PI) / (visualDuration * 1.2);
|
|
858
|
+
const stiffness = root * root;
|
|
859
|
+
const damping = 2 * clamp(0.05, 1, 1 - options.bounce) * Math.sqrt(stiffness);
|
|
860
|
+
springOptions = {
|
|
861
|
+
...springOptions,
|
|
862
|
+
mass: springDefaults.mass,
|
|
863
|
+
stiffness,
|
|
864
|
+
damping,
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
const derived = findSpring(options);
|
|
869
|
+
springOptions = {
|
|
870
|
+
...springOptions,
|
|
871
|
+
...derived,
|
|
872
|
+
mass: springDefaults.mass,
|
|
873
|
+
};
|
|
874
|
+
springOptions.isResolvedFromDuration = true;
|
|
875
|
+
}
|
|
796
876
|
}
|
|
797
877
|
return springOptions;
|
|
798
878
|
}
|
|
799
|
-
function spring(
|
|
800
|
-
const
|
|
801
|
-
|
|
879
|
+
function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce = springDefaults.bounce) {
|
|
880
|
+
const options = typeof optionsOrVisualDuration !== "object"
|
|
881
|
+
? {
|
|
882
|
+
visualDuration: optionsOrVisualDuration,
|
|
883
|
+
keyframes: [0, 1],
|
|
884
|
+
bounce,
|
|
885
|
+
}
|
|
886
|
+
: optionsOrVisualDuration;
|
|
887
|
+
let { restSpeed, restDelta } = options;
|
|
888
|
+
const origin = options.keyframes[0];
|
|
889
|
+
const target = options.keyframes[options.keyframes.length - 1];
|
|
802
890
|
/**
|
|
803
891
|
* This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
|
|
804
892
|
* to reduce GC during animation.
|
|
@@ -820,8 +908,12 @@ function spring({ keyframes, restDelta, restSpeed, ...options }) {
|
|
|
820
908
|
* ratio between feeling good and finishing as soon as changes are imperceptible.
|
|
821
909
|
*/
|
|
822
910
|
const isGranularScale = Math.abs(initialDelta) < 5;
|
|
823
|
-
restSpeed || (restSpeed = isGranularScale
|
|
824
|
-
|
|
911
|
+
restSpeed || (restSpeed = isGranularScale
|
|
912
|
+
? springDefaults.restSpeed.granular
|
|
913
|
+
: springDefaults.restSpeed.default);
|
|
914
|
+
restDelta || (restDelta = isGranularScale
|
|
915
|
+
? springDefaults.restDelta.granular
|
|
916
|
+
: springDefaults.restDelta.default);
|
|
825
917
|
let resolveSpring;
|
|
826
918
|
if (dampingRatio < 1) {
|
|
827
919
|
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
@@ -862,7 +954,7 @@ function spring({ keyframes, restDelta, restSpeed, ...options }) {
|
|
|
862
954
|
dampedAngularFreq);
|
|
863
955
|
};
|
|
864
956
|
}
|
|
865
|
-
|
|
957
|
+
const generator = {
|
|
866
958
|
calculatedDuration: isResolvedFromDuration ? duration || null : null,
|
|
867
959
|
next: (t) => {
|
|
868
960
|
const current = resolveSpring(t);
|
|
@@ -890,23 +982,13 @@ function spring({ keyframes, restDelta, restSpeed, ...options }) {
|
|
|
890
982
|
state.value = state.done ? target : current;
|
|
891
983
|
return state;
|
|
892
984
|
},
|
|
985
|
+
toString: () => {
|
|
986
|
+
const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
|
|
987
|
+
const easing = generateLinearEasing((progress) => generator.next(calculatedDuration * progress).value, calculatedDuration, 30);
|
|
988
|
+
return calculatedDuration + "ms " + easing;
|
|
989
|
+
},
|
|
893
990
|
};
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* Implement a practical max duration for keyframe generation
|
|
898
|
-
* to prevent infinite loops
|
|
899
|
-
*/
|
|
900
|
-
const maxGeneratorDuration = 20000;
|
|
901
|
-
function calcGeneratorDuration(generator) {
|
|
902
|
-
let duration = 0;
|
|
903
|
-
const timeStep = 50;
|
|
904
|
-
let state = generator.next(duration);
|
|
905
|
-
while (!state.done && duration < maxGeneratorDuration) {
|
|
906
|
-
duration += timeStep;
|
|
907
|
-
state = generator.next(duration);
|
|
908
|
-
}
|
|
909
|
-
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
991
|
+
return generator;
|
|
910
992
|
}
|
|
911
993
|
|
|
912
994
|
/**
|
|
@@ -947,23 +1029,6 @@ const mixNumber$1 = (from, to, progress) => {
|
|
|
947
1029
|
return from + (to - from) * progress;
|
|
948
1030
|
};
|
|
949
1031
|
|
|
950
|
-
/*
|
|
951
|
-
Progress within given range
|
|
952
|
-
|
|
953
|
-
Given a lower limit and an upper limit, we return the progress
|
|
954
|
-
(expressed as a number 0-1) represented by the given value, and
|
|
955
|
-
limit that progress to within 0-1.
|
|
956
|
-
|
|
957
|
-
@param [number]: Lower limit
|
|
958
|
-
@param [number]: Upper limit
|
|
959
|
-
@param [number]: Value to find progress within given range
|
|
960
|
-
@return [number]: Progress of value within range as expressed 0-1
|
|
961
|
-
*/
|
|
962
|
-
const progress = (from, to, value) => {
|
|
963
|
-
const toFromDifference = to - from;
|
|
964
|
-
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
|
965
|
-
};
|
|
966
|
-
|
|
967
1032
|
function fillOffset(offset, remaining) {
|
|
968
1033
|
const min = offset[offset.length - 1];
|
|
969
1034
|
for (let i = 1; i <= remaining; i++) {
|
|
@@ -3322,18 +3387,6 @@ const acceleratedValues = new Set([
|
|
|
3322
3387
|
// "background-color"
|
|
3323
3388
|
]);
|
|
3324
3389
|
|
|
3325
|
-
// Create a linear easing point for every 10 ms
|
|
3326
|
-
const resolution = 10;
|
|
3327
|
-
const generateLinearEasing = (easing, duration // as milliseconds
|
|
3328
|
-
) => {
|
|
3329
|
-
let points = "";
|
|
3330
|
-
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
3331
|
-
for (let i = 0; i < numPoints; i++) {
|
|
3332
|
-
points += easing(progress(0, numPoints - 1, i)) + ", ";
|
|
3333
|
-
}
|
|
3334
|
-
return `linear(${points.substring(0, points.length - 2)})`;
|
|
3335
|
-
};
|
|
3336
|
-
|
|
3337
3390
|
/**
|
|
3338
3391
|
* Add the ability for test suites to manually set support flags
|
|
3339
3392
|
* to better test more environments.
|
|
@@ -4103,7 +4156,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4103
4156
|
* and warn against mismatches.
|
|
4104
4157
|
*/
|
|
4105
4158
|
if (process.env.NODE_ENV === "development") {
|
|
4106
|
-
warnOnce(nextValue.version === "11.
|
|
4159
|
+
warnOnce(nextValue.version === "11.12.0", `Attempting to mix Motion versions ${nextValue.version} with 11.12.0 may not work as expected.`);
|
|
4107
4160
|
}
|
|
4108
4161
|
}
|
|
4109
4162
|
else if (isMotionValue(prevValue)) {
|
|
@@ -5251,6 +5304,7 @@ class NativeAnimation {
|
|
|
5251
5304
|
valueKeyframes = [valueKeyframes];
|
|
5252
5305
|
}
|
|
5253
5306
|
hydrateKeyframes(valueName, valueKeyframes, readInitialKeyframe);
|
|
5307
|
+
// TODO: Replace this with toString()?
|
|
5254
5308
|
if (isGenerator(options.type)) {
|
|
5255
5309
|
const generatorOptions = createGeneratorEasing(options, 100, options.type);
|
|
5256
5310
|
options.ease = supportsLinearEasing()
|
|
@@ -5389,7 +5443,7 @@ function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
|
5389
5443
|
for (const valueName in keyframes) {
|
|
5390
5444
|
const valueKeyframes = keyframes[valueName];
|
|
5391
5445
|
const valueOptions = {
|
|
5392
|
-
...getValueTransition(
|
|
5446
|
+
...getValueTransition(elementTransition, valueName),
|
|
5393
5447
|
};
|
|
5394
5448
|
valueOptions.duration = valueOptions.duration
|
|
5395
5449
|
? secondsToMilliseconds(valueOptions.duration)
|
package/dist/cjs/mini.js
CHANGED
|
@@ -163,9 +163,8 @@ const progress = (from, to, value) => {
|
|
|
163
163
|
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const generateLinearEasing = (easing, duration // as milliseconds
|
|
166
|
+
const generateLinearEasing = (easing, duration, // as milliseconds
|
|
167
|
+
resolution = 10 // as milliseconds
|
|
169
168
|
) => {
|
|
170
169
|
let points = "";
|
|
171
170
|
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
@@ -403,6 +402,7 @@ class NativeAnimation {
|
|
|
403
402
|
valueKeyframes = [valueKeyframes];
|
|
404
403
|
}
|
|
405
404
|
hydrateKeyframes(valueName, valueKeyframes, readInitialKeyframe);
|
|
405
|
+
// TODO: Replace this with toString()?
|
|
406
406
|
if (isGenerator(options.type)) {
|
|
407
407
|
const generatorOptions = createGeneratorEasing(options, 100, options.type);
|
|
408
408
|
options.ease = supportsLinearEasing()
|
|
@@ -541,7 +541,7 @@ function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
|
541
541
|
for (const valueName in keyframes) {
|
|
542
542
|
const valueKeyframes = keyframes[valueName];
|
|
543
543
|
const valueOptions = {
|
|
544
|
-
...getValueTransition(
|
|
544
|
+
...getValueTransition(elementTransition, valueName),
|
|
545
545
|
};
|
|
546
546
|
valueOptions.duration = valueOptions.duration
|
|
547
547
|
? secondsToMilliseconds(valueOptions.duration)
|