DIR : /home/kozerus/public_html/cropex/node/node_modules/framer-motion/dist/es/frameloop/sync-time.mjs

/home/kozerus/public_html/cropex/node/node_modules/framer-motion/dist/es/frameloop

import { MotionGlobalConfig } from '../utils/GlobalConfig.mjs';
import { frameData } from './frame.mjs';

let now;
function clearTime() {
    now = undefined;
}
/**
 * An eventloop-synchronous alternative to performance.now().
 *
 * Ensures that time measurements remain consistent within a synchronous context.
 * Usually calling performance.now() twice within the same synchronous context
 * will return different values which isn't useful for animations when we're usually
 * trying to sync animations to the same frame.
 */
const time = {
    now: () => {
        if (now === undefined) {
            time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming
                ? frameData.timestamp
                : performance.now());
        }
        return now;
    },
    set: (newTime) => {
        now = newTime;
        queueMicrotask(clearTime);
    },
};

export { time };
//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer