API Reference › Light › Light.time_of_day
method

Light.time_of_day

Light.time_of_day(t)

Sets the scene's ambient tint from a single **time-of-day** phase t — a fixed in [0, 1] where 0 is midnight, 0.25 dawn, 0.5 noon and 0.75 dusk. It ramps a deep-blue night up to full daylight and back over the day, so a game animates one value and the whole world's mood follows, without wiring the ambient colour by hand. It drives the same multiplicative modulate as Light.ambient, so call it once before adding lights. Deterministic (Q16.16 triangle ramp).

Parameters

tthe time of day, a fixed in [0, 1] (0 = midnight, 0.5 = noon)

Example

program Demo {
  property Clock { t: int = 0 }
  model World { Clock }
  handler Render phase Update {
    Screen.clear(Color.rgb(255, 255, 255))
    Light.time_of_day(0.5)                                 # high noon — full daylight
    Light.point(80, 60, 60, Color.rgb(255, 240, 200), 1.0)
    Screen.show()
  }
}
← All symbols