Hi guys
I just thought I'd share a prototype of my latest little coding project with you It basically utilises PHP to construct a cartoon-like image of the view from my window at home.
What's so special about that? Well, the image created is dynamic and thus changes appearance according to the data it is provided.
At present, the code behind the image retrieves real-time XML weather data for my locality and reflects this in the image it produces, so if it's snowing outside my window it will be snowing in the image.
The image also changes according to what time of day it is (sunrise, daytime, sunset or night time), and calculates the daylight hours from accurate sunrise and sunset times at my location. Finally, the image produced also reflects what season of the year it is (spring, summer, autumn or winter).
At present the whole thing is just a proof of concept, so the images are nothing like the final ones (especially the weather images which don't really represent the weather accurately). Also the seasons and a few other bits and bobs are missing at present. However, when it's all finished everything should function as follows:
Code:
[u]Sky[/u]
[i]Season[/i] - The hours of daylight are calculated from accurate sunrise and sunset times. (Implemented)
[i]Time of Day[/i] - The sky changes according to whether it is sunrise, daytime, sunset or night time. (Implemented)
[i]Weather[/i] - Accurate weather information changes the appearance of the sky (e.g. clouds, sunshine etc.). (Semi-Implemented)
[u]Trees[/u]
[i]Season[/i] - The trees change appearance with the season (e.g. colour and number of leaves etc.). (Unimplemented)
[i]Time of Day[/i] - The shadows cast by the trees elongate at sunrise and sunset. (Unimplemented)
[i]Weather[/i] - Trees sway when windy, get covered in snow etc. (Unimplemented)
[u]Road[/u]
[i]Time of Day[/i] - The street lights on the road glow amber and yellow at sunset and night time. (Implemented)
[i]Weather[/i] - uddles and snow appear in the road when raining or snowing. (Unimplemented)
[u]Fields[/u]
[i]Weather[/i] - Puddles and snow appear in the road when raining or snowing. (Unimplemented)
[u]River[/u]
[i]Weather[/i] - The river freezes over during in wintertime. (Unimplemented)
[u]Possibilities[/u]
I'd also like to try and accurately move the sun and moon across the sky and a few sheep and cows to boot too.
The script itself has been heavily optimised and only runs at set, albeit frequent, intervals - not everytime a user visits - thus reducing the load on the server and on the number of requests to the XML weather provider.
Well, that's about it Like I say, this is a prototype, so be gentle with me as there's still a lot more to do.
Kind Regards
Jonty
P.S. Although the coding, images etc. are mine, the original idea of using weather data is this way is not. I'll try and dig out the site if I can find it again, as it's truly spectacular.