threejs-worldgen
    Preparing search index...

    Class SkyClock

    The simulation clock: time scale, pause, set date/time and a "day length" shortcut. Deterministic: the sky at a given SkyClock.time is always the same, however you got there.

    const clock = new SkyClock({ date: '2026-03-20T06:00:00Z', dayLength: 300 }) // 5-minute days
    clock.update(dt) // once per frame, real seconds
    clock.date // current Date
    clock.setDate('2026-12-21T12:00:00Z')
    Index
    delta: number = 0

    Simulation seconds advanced by the last SkyClock.update.

    frameDelta: number = 0

    Real seconds of the last SkyClock.update, paused or not (for things like exposure adaptation).

    realDelta: number = 0

    Real seconds of the last SkyClock.update (0 while paused).

    settings: ClockOptions = ...

    Resolved settings. Change them with SkyClock.set / SkyClock.reset.

    solarDay: number = 86400

    Length of the home planet's solar day in simulation seconds, used by dayLength. Set by Sky.

    time: number = 0

    Simulation seconds since J2000. Change it with SkyClock.setTime or SkyClock.setDate.

    • get rate(): number

      Simulated seconds per real second right now (after dayLength and paused).

      Returns number

    • Moves time by seconds (negative goes back).

      Parameters

      • seconds: number

      Returns this

    • Replaces all settings (missing ones go back to defaults). Time only jumps if date changed.

      Parameters

      Returns this

    • Jumps to a date (Date, ISO string or Unix ms).

      Parameters

      • date: string | number | Date

      Returns this

    • Jumps to simulation seconds since J2000.

      Parameters

      • time: number

      Returns this

    • Advances time. Call once per frame.

      Parameters

      • Optionaldt: number

        Real seconds since the last call. Omit to measure it with performance.now().

      Returns number

      Simulation seconds advanced.