Files
Webklar.com/node_modules/framer-motion/dist/es/value/use-computed.mjs
Basilosaurusrex f027651f9b main repo
2025-11-24 18:09:40 +01:00

21 lines
593 B
JavaScript

"use client";
import { collectMotionValues } from 'motion-dom';
import { useCombineMotionValues } from './use-combine-values.mjs';
function useComputed(compute) {
/**
* Open session of collectMotionValues. Any MotionValue that calls get()
* will be saved into this array.
*/
collectMotionValues.current = [];
compute();
const value = useCombineMotionValues(collectMotionValues.current, compute);
/**
* Synchronously close session of collectMotionValues.
*/
collectMotionValues.current = undefined;
return value;
}
export { useComputed };