hex-world
    Preparing search index...

    Class DayNightCycle

    Time-of-day model: an animated clock mapped to sun/moon direction, light and ambient colors with warm dawn/dusk tinting, a cool moonlight mode at night, and matching sky + liquid tints. Pure state machine — pair it with DayNightTargets via applyTo to drive a scene, or read evaluate and push the values yourself.

    One directional light plays both roles: while the sun is up it is the sun; at night it swaps to the moon's direction (exactly opposite) with a dim blue color. The swap happens at the horizon, where both intensities are zero, so it is never visible.

    const cycle = new DayNightCycle({ dayLength: 180 });
    // per frame:
    cycle.advance(dt);
    cycle.applyTo({ sunRig, ambientLight, terrainMaterial, liquidMaterials, scene });
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    dayLength: number

    Real seconds per full cycle when animating.

    paused: boolean

    Freeze/unfreeze the clock (setTime still works while paused).

    Accessors

    Methods

    • Advance the clock by dt real seconds (no-op while paused).

      Parameters

      • dt: number

      Returns void