@realsee/dnalogel
Version:
29 lines (28 loc) • 683 B
JavaScript
import "../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
const i = window.requestAnimationFrame || ((e) => setTimeout(e, 16)), u = window.cancelAnimationFrame || clearTimeout;
function T(e, t = 0) {
t <= 0 ? i(e) : i(() => T(e, t - 1));
}
function F(e, t = 60) {
let o = -1, m = 0, r = -1;
const s = 1e3 / t;
function a(n) {
r === -1 && (r = n), o = i(a), !(n - m < s) && (m = n, e == null || e(n - r));
}
return o = i(a), function() {
u(o);
};
}
function f() {
const e = Date.now();
return new Promise((t) => {
i(() => {
t(Date.now() - e);
});
});
}
export {
f as getFrameTime,
T as nextFrame,
F as requestAnimationFrameInterval
};