Színkorrekciók
This commit is contained in:
1 parent
34a6df5949
commit
a1ff3beb35
471 files changed
+63615
-6
No files matched your search
+18
@@ -0,0 +1,18 @@
|
||||
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 };
|
||||
Reference in new issue
Block a user