They say
a picture paints a thousand words so I will try to show here my weather forecast section and what the animation effect brings to that.
IMHO, this gives a better feel for the users of my app than the normal weather animations we see on the web or on our mobile gadgets. Plus I always like to have something unique for my apps.
Now, for you be able to achieve the same effect, what you need to do is download animated images from the web, create a table for it, store it to a
memo or
blob field, and create another field to trap the weather condition which is unique with the web site you will be getting your forecast from.
Like I said with the first blog about this, what I do then on my end is refresh data every 60 seconds and display result on the section of my form for that. Then I perform an SQL SELECT to get all animations stored on my table which has the same weather condition on the current hour forecast, and finally picks one randomly to be shown above the forecast.
Here is the section of said weather forecast for you to see. Although the image of the grid representing the forecast is not clear here because I have to resize it larger to fit with the animated image I have shown here whereas on my app, it is the other way around. The animated image is stretched to fit with the same size of my actual grid below.
Foolish me! I like this animated image of raining so I chose it. So as not to confuse the readers, I've overwritten the Cloudy weather with Heavy Rain but forgot to change the caption of Current Weather. LOL!
And here is the portion where it randomly picks for an animated image:
* Select Animation
Use weather In 0 Shared
Use weathergrp In 0 Shared
With This.imgweather
.Picture = ''
* Get an
animation based on Weather
Select t1.wimage,
t2.Descript From weather t1;
LEFT Outer Join weathergrp t2;
ON t2.wgpk =
t1.wgfk;
WHERE Alltrim(t2.Descript) ==
m.lcWeather ;
Into Cursor JunkWeather NOFILTER
If _Tally > 0
Goto (1 + _Tally * Rand( ))
lcImage = Addbs(Getenv("TEMP"))+'weather.gif'
Strtofile(JunkWeather.wimage,m.lcImage)
.Picture = m.lcImage
.Visible = .T.
Else
.Visible = .F.
Endif
Use In Select('Weather')
Use In Select('WeatherGrp')
Endwith
* End of Select Animation
Its advantage is speed, being all data are localized. You won't see it lagging as both the weather forecast info and weather animation is updated/changed in a split second .
You can achieve the same on your end, just follow the ideas I shared here and in the first part of localized data blog. Cheers!