pronotron-tech-art-suite
    Preparing search index...

    Class PronotronClock

    PronotronClock

    A dual-domain clock that tracks both:

    • Global time — always progresses (unaffected by tab focus)
    • Active time — pauses when the screen/tab is unfocused

    This allows animations or logic to selectively follow either time domain.

    const clock = new PronotronClock();
    const handleVisibilityChange = () => {
    if ( document.hidden ){
    clock.pause();
    } else {
    clock.resume();
    }
    };
    document.addEventListener( 'visibilitychange', handleVisibilityChange );

    // In your main loop:
    function frame()
    {
    const delta = clock.tick();
    const { elapsedTime, elapsedPausedTime } = clock.getTime();
    // ...rest
    }
    frame();
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Returns the current time states for both global and active timelines.

      Returns { elapsedPausedTime: number; elapsedTime: number }

    • Pauses the "active" time domain without affecting global time. Call when the window or app loses focus.

      Returns void

    • Resumes the "active" time domain. Adjusts for time spent paused so that active time remains continuous.

      Returns void

    • Advances the clock by one frame and computes the delta time. Call this once per render frame

      Returns number

      The time elapsed since the previous tick (delta time), in seconds.