Module src.helpers.daycycle
Daycycle helper module.
Calculates the sky‐time factor and environment brightness from a 24h clock, and provides a formatter for human‐readable HH:MM strings.
Functions
computeDaycycle (dayTime) | Compute sky‐time and environment brightness from a dayTime value. |
formatTime (dayTime) | Format a floating‐point hour into an HH:MM string. |
Functions
- computeDaycycle (dayTime)
-
Compute sky‐time and environment brightness from a dayTime value. Wraps any 24h‐based
dayTime
into: 1. asunFactor
in [0..1] suitable forskyExt:setDaytime()
2. anenvBright
in 0..constants.maxBrightness or up toconstants.maxNightBright (night) for <code>dream:setSky()</code>
Parameters:
- dayTime number Current time in hours (can be outside 0–24; will wrap)
Returns:
- number sunFactor Normalized sun position factor (0–1)
- number envBright Computed environment brightness
- formatTime (dayTime)
-
Format a floating‐point hour into an HH:MM string.
Parameters:
- dayTime number Time in hours (float; wraps into 0–24)
Returns:
-
string
timeStr Formatted time string, zero-padded (e.g. “09:05”)