SDK JS
    Preparing search index...

    The handle returned by setTimeOfDay. Mutate the scene's sun through it (date, location, enable, animation) and subscribe to changes for a custom widget. Call Atmosphere.dispose to detach everything and restore the map's original light/sky.

    const atmosphere: Atmosphere = setTimeOfDay({
    map,
    location: 'map-center',
    layers: [buildings],
    date: new Date(),
    });

    // Drive it from your own UI, then detach when the view closes.
    atmosphere.setDate(new Date('2026-06-21T12:00:00Z'));
    atmosphere.dispose();
    interface Atmosphere {
        enabled: boolean;
        isAnimating: boolean;
        shadows: boolean;
        state: SunState;
        system: GeoSunSystem;
        addLayer(layer: SunLightable): void;
        animate(opts?: AnimateOptions): void;
        dispose(): void;
        onChange(cb: (s: SunState) => void): () => void;
        removeLayer(layer: SunLightable): void;
        setDate(date: Date): SunState;
        setEnabled(on: boolean): void;
        setLocation(loc: LocationOption): void;
        setRate(rate: number): void;
        setShadows(on: boolean): void;
        setSyncMapLibreLight(on: boolean): void;
        stop(): void;
    }
    Index

    Properties

    enabled: boolean

    Whether the geo-sun system is currently driving the scene (see Atmosphere.setEnabled).

    isAnimating: boolean

    Whether a time-lapse animation is currently running.

    shadows: boolean

    Whether cast shadows are on (see Atmosphere.setShadows). Readable so a control can show the truth instead of guessing: enabled was already readable and shadows was not, which is why SunControlWidget seeded its switch to a hardcoded false and contradicted a scene that was casting.

    state: SunState

    The current SunState (last computed for the current date + location).

    system: GeoSunSystem

    The underlying GeoSunSystem fanning the sun out to its controllers.

    Methods

    • Detach all controllers and listeners, stop any animation, and restore the map's original light/sky. Call when tearing the scene down.

      Returns void

    • Subscribe to every SunState change (date, location, animation). Returns an unsubscribe function. Ideal for driving a custom HUD/widget.

      Parameters

      Returns () => void

    • Remove a previously wired layer (it keeps its last lighting; it is no longer updated).

      Parameters

      Returns void

    • Set the instant to render and re-drive the whole scene; returns the new SunState. date is a Date (UTC for solar math).

      Parameters

      • date: Date

      Returns SunState

    • Master on/off. When disabled, the map's light/sky are restored and the layers revert to their baseline look; the selected date + shadow preference are preserved and re-applied on re-enable.

      Parameters

      • on: boolean

      Returns void

    • Change the running animation's speed (simulated seconds per real second).

      Parameters

      • rate: number

      Returns void

    • Toggle real cast shadows on the wired layers (Phase 2). The preference persists across enable/disable and date changes.

      Parameters

      • on: boolean

      Returns void

    • Toggle the MapLibre visual sync (setLight / setSky). When turned off (while enabled), the map's pre-atmosphere light/sky are restored; the 3D layers stay sun-lit.

      Parameters

      • on: boolean

      Returns void

    • Stop the animation, holding the current instant.

      Returns void