I’ve always been fascinated by how coding can reflect the real world, so I put together a simple personal project that ties the beauty of the sun’s cycle to your browser. This little experiment uses Three.js to render a dynamic environment while calculating sunrise and sunset times based on your location.
Thanks to the SunCalc library and a touch of geolocation magic, the app automatically detects whether it’s daytime or nighttime for you.
Cloud animations build on top of a demo by Mr.doob , whose work inspired me to dive deeper into Three.js.
Looking ahead, I’m considering expanding this project to include effects based on the actual position of the sun and the quality of light at different times of the day. Imagine subtle color shifts to mimic sunrise or sunset, or even dynamic themes that respond to local weather conditions like rain or snow. It’s an exciting challenge that could bring even more realism and immersion to this simple concept.
Demo's source code can be spotted right here