INNER CODE UNIT · JavaScript

tickMultiple

loicbourgois/gravitle · front/alpha/index.js:135

const tickMultiple = () => {
    const now = Date.now();
    delta = now - time;
    const resolution = universe.get_delta_time_milli();
    while (delta > resolution) {
        delta -= resolution;
        tick();
    }
    time = now - delta;
};

const start = () => {
    time = Date.now();
    interval = setInterval(tickMultiple, 1);
    requestAnimationFrame(render_loop);
    canvas.focus();
};

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…