INNER CODE UNIT · JavaScript

tick

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

const tick = () => {
    universe.tick();
};

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);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…