framer-motion 12.34.0-alpha.0 → 12.34.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 +42 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/dom.js +1 -1
- package/dist/es/value/use-scroll.mjs +24 -0
- package/dist/es/value/use-scroll.mjs.map +1 -1
- package/dist/es/value/use-transform.mjs +18 -1
- package/dist/es/value/use-transform.mjs.map +1 -1
- package/dist/framer-motion.dev.js +118 -119
- package/dist/framer-motion.js +1 -1
- package/dist/size-rollup-animate.js +1 -1
- package/dist/size-rollup-animate.js.map +1 -1
- package/dist/size-rollup-dom-animation-assets.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max-assets.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js.map +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-rollup-motion.js.map +1 -1
- package/dist/size-rollup-scroll.js +1 -1
- package/dist/size-rollup-scroll.js.map +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -792,9 +792,26 @@ function useTransform(input, inputRangeOrTransformer, outputRangeOrMap, options)
|
|
|
792
792
|
const transformer = typeof inputRangeOrTransformer === "function"
|
|
793
793
|
? inputRangeOrTransformer
|
|
794
794
|
: motionDom.transform(inputRangeOrTransformer, outputRange, options);
|
|
795
|
-
|
|
795
|
+
const result = Array.isArray(input)
|
|
796
796
|
? useListTransform(input, transformer)
|
|
797
797
|
: useListTransform([input], ([latest]) => transformer(latest));
|
|
798
|
+
const inputAccelerate = !Array.isArray(input)
|
|
799
|
+
? input.accelerate
|
|
800
|
+
: undefined;
|
|
801
|
+
if (inputAccelerate &&
|
|
802
|
+
!inputAccelerate.isTransformed &&
|
|
803
|
+
typeof inputRangeOrTransformer !== "function" &&
|
|
804
|
+
Array.isArray(outputRangeOrMap) &&
|
|
805
|
+
options?.clamp !== false) {
|
|
806
|
+
result.accelerate = {
|
|
807
|
+
...inputAccelerate,
|
|
808
|
+
times: inputRangeOrTransformer,
|
|
809
|
+
keyframes: outputRangeOrMap,
|
|
810
|
+
isTransformed: true,
|
|
811
|
+
...(options?.ease ? { ease: options.ease } : {}),
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
return result;
|
|
798
815
|
}
|
|
799
816
|
function useListTransform(values, transformer) {
|
|
800
817
|
const latest = featureBundle.useConstant(() => []);
|
|
@@ -2152,6 +2169,30 @@ const isRefPending = (ref) => {
|
|
|
2152
2169
|
};
|
|
2153
2170
|
function useScroll({ container, target, ...options } = {}) {
|
|
2154
2171
|
const values = featureBundle.useConstant(createScrollMotionValues);
|
|
2172
|
+
values.scrollXProgress.accelerate = {
|
|
2173
|
+
factory: (animation) => scroll(animation, {
|
|
2174
|
+
...options,
|
|
2175
|
+
axis: "x",
|
|
2176
|
+
container: container?.current || undefined,
|
|
2177
|
+
target: target?.current || undefined,
|
|
2178
|
+
}),
|
|
2179
|
+
times: [0, 1],
|
|
2180
|
+
keyframes: [0, 1],
|
|
2181
|
+
ease: (v) => v,
|
|
2182
|
+
duration: 1,
|
|
2183
|
+
};
|
|
2184
|
+
values.scrollYProgress.accelerate = {
|
|
2185
|
+
factory: (animation) => scroll(animation, {
|
|
2186
|
+
...options,
|
|
2187
|
+
axis: "y",
|
|
2188
|
+
container: container?.current || undefined,
|
|
2189
|
+
target: target?.current || undefined,
|
|
2190
|
+
}),
|
|
2191
|
+
times: [0, 1],
|
|
2192
|
+
keyframes: [0, 1],
|
|
2193
|
+
ease: (v) => v,
|
|
2194
|
+
duration: 1,
|
|
2195
|
+
};
|
|
2155
2196
|
const scrollAnimation = React.useRef(null);
|
|
2156
2197
|
const needsStart = React.useRef(false);
|
|
2157
2198
|
const start = React.useCallback(() => {
|