Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Assuming the bar is drawn with a line on an axis between 0 and 1.0, an empty bar would be (0,0), a full bar would be (0,1.0), left half would be (0,0.5), and right half would be (0.5,1.0)
- Right now, I'm assuming the sun bar is calculated something like this:
- get_sun_line(time_now, time_dawn, time_dusk) {
- if (time_now < time_dawn) or (time_now > time_dusk) {
- return (0,0)
- }
- minutes_total := time_dusk - time_dawn
- minutes_now := time_now - time_dawn
- x := minutes_now / minutes_total
- return (0, x)
- }
- In other words, near dawn (dim light) the bar is small, at noon (brightest light) it is half, and at dusk (dim light) it is full. But isn't it more natural to have noon be full bar, and have the bar small near dawn and dusk (but on opposite sides)?
- So, something like this?
- get_sun_line(time_now, time_dawn, time_dusk) {
- if (time_now < time_dawn) or (time_now > time_dusk) {
- return (0,0)
- }
- solar_noon := median(time_dawn, time_dusk)
- if (time_now <= solar_noon) {
- x_left := 0
- } else {
- x_left := (time_now - solar_noon) / (time_dusk - solar_noon)
- }
- if (time_now >= solar_noon) {
- x_right := 1.0
- } else {
- x_right := (time_now - time_dawn) / (solar_noon - time_dawn)
- }
- return (x_left, x_right)
- }
- This would also more closely resemble the encoding of the moon bar, no?
Advertisement
Add Comment
Please, Sign In to add comment