It is currently April 20th, 2024, 6:49 am

animated weather image

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: animated weather image

Post by jsmorley »

I really don't think you want two of those image animations, one running right on top of the other, at the same time. Rainmeter is at best marginally good at "always running" animations based on a very low skin Update rate, and you can easily overwhelm it a bit with a lot of image resizing and redrawing going on at Update=60.
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: animated weather image

Post by xenium »

jsmorley wrote:I really don't think you want two of those image animations, one running right on top of the other, at the same time. Rainmeter is at best marginally good at "always running" animations based on a very low skin Update rate, and you can easily overwhelm it a bit with a lot of image resizing and redrawing going on at Update=60.
Does not run at the same time.
I want to get a different animation depending on the weather conditions
Is the situation that you have here:
jsmorley wrote:Glad to help.

The next thing you are going to want to address is how you get a different animation based on the weather conditions returned from the site.

Most weather sites will return a "number" that corresponds to an icon. So 32 might be what it uses for "sunny" and 28 might be what it uses for "partly cloudy".

So what you want, in my view, is to rethink your naming convention a bit...

In your @Resources folder in the skin, I would create an Images sub-folder. So \@Resources\Images\

In that I would create 48 sub-folders, named with just the numbers from 0 to 47

\@Resources\Images\0\
\@Resources\Images\1\
...
\@Resources\Images\47\

In each of those, I would put the FrameXX.png files that correspond to the desired animation

\@Resources\Images\0\Frame0.png
\@Resources\Images\0\Frame1.png
...
\@Resources\Images\0\Frame16.png

Then in your meter that does the animation, I would use:

Code: Select all

[MeterSymbol]
Meter=Image
ImageName=#@#Images\[MeasureSymbol]\Frame[measureCalc_d100].png
X=0
Y=0
DynamicVariables=1
So what that will do is have it look in the "folder" associated with the icon number, assuming that [MeasureSymbol] is returning the icon number from 0-47, and then use that folder to get the "frames" for the animation.

The reason you want to use @Resources (create it if it doesn't exist) is because when Rainmeter is loaded or refreshed, it will scan all folders under ..Documents\Rainmeter\Skins\ looking for .ini files. It won't however scan in any @Resources folders, and there is no point in having Rainmeter traverse all those icon / animation folders when it refreshes.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: animated weather image

Post by jsmorley »

I think you will want to look at something like this:

Code: Select all

[Rainmeter]
Author=xxenium
AppVersion=1.0
Update=60

[Variables]
UpdateRateSeconds=10000
FontFace=Subpear
URL=https://www.foreca.com/Argentine/Buenos_Aires?tenday
URL1=https://www.foreca.com/Argentine/Buenos_Aires

=============Measure=============

[MeasureName]
Measure=WebParser
Url=#URL#
RegExp="(?siU)<h1>(.*)</h1>.*"
UpdateRate=#UpdateRateSeconds#
Substitute="&deg;":""
StringIndex=1

[MeasureSymbol]
Measure=WebParser
Url=#URL1#
RegExp="(?siU)<div class="symbol_70x70.* symbol_(.*)_70x70 cc_symb".*"
StringIndex=1
UpdateRate=#UpdateRateSeconds#
FinishAction=[!EnableMeasureGroup Counters][!UpdateMeasure MeasureSetCounter]

[MeasureConditions]
Measure=WebParser
Url=#URL1#
RegExp="(?siU)<div class="right txt-tight">(.*)<br />.*"
UpdateRate=#UpdateRateSeconds#
StringIndex=1
RegExpSubstitute=1
Substitute="\t":"","#CRLF#":""

[MeasureSetCounter]
Measure=String
Group=Counters
String=[MeasureSymbol]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfMatch=(?i)d000
IfMatchAction=[!SetOption MeasureCounter Formula "Counter % 50"]
IfMatch2=(?i)d100
IfMatchAction2=[!SetOption MeasureCounter Formula "Counter % 20"]

[MeasureCounter]
Measure=Calc
Group=Counters
Disabled=1

==============Meter===================

[MeterImage]
Meter=Image
ImageName=#@#Images\[MeasureSymbol]\Frame[MeasureCounter].png
X=14
Y=35
DynamicVariables=1

[MeterName]
Meter=String
MeasureName=MeasureName
X=185
Y=45
W=190
H=50
FontColor=250,250,250,250
StringStyle=bold
StringEffect=SHADOW
FontFace=Subpear
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
ClipString=1
FontSize=12

[MeterConditions]
Meter=String
MeasureName=MeasureConditions
X=30
Y=80
W=200
H=150
FontColor=250,250,250,250
FontSize=22
FontFace=Calibri
StringStyle=BOLD
StringAlign=Left
StringEffect=SHADOW
FontEffectColor=0,0,0,80
ClipString=1
AntiAlias=1
So the point of this is to have "one" image meter, and just have it dynamically use the correct "path" based on the current weather conditions.

Now the second issue is that you have different numbers of images for different weather conditions. That means you need to adjust that "Counter" as well to match the conditions. That is what [MeasureSetCounter] is for.

If you look, I'm being careful not to have the skin doing more work than it has to at an Update of 60, as that is going to stress Rainmeter enough even when we are as efficient as we can be. I only update [MeasureSetCounter] once when the WebParser measure is done getting the conditions, and don't allow [MeasureCounter] to run at all until we have a value.

There will be a few initial errors in the log when you first load or refresh the skin, as WebParser won't have had time to go get the conditions, but the Image meter will be looking for a value for [MeasureSymbol]. That can be addressed, but I didn't think it was important enough to further complicate things just yet.

This is going to mean a boatload of IfMatch conditions on [MeasureSetCounter], which is unfortunate, but that is the price you are going to pay for not having all animations use a consistent number of images.

Let me know if you have any questions.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: animated weather image

Post by jsmorley »

I have to caution that I'm not a huge fan of this idea. Rainmeter is just NOT GOOD at running constant animations at all times with a very low Update value in a skin.

The issue is that Rainmeter updates ALL skins in a big cycle, and there needs to be time for all skins to update and redraw gracefully one after the other during that cycle. With one skin set to Update=60 and doing a lot of work, you can and will see some lag once a second or so in the animation, as Rainmeter will have some trouble keeping up. If you run only a few other skins, this will be tiny to completely unnoticeable. However, if you are running a lot of other skins, or have other skins that are doing a lot of work, you can get a bit of "jerky" behavior.

In particular, this is going to be evident if you have other skins that are using the AdvancedCPU or PerfMon plugins... They actually kinda suck, and cause a tiny "pause" in Rainmeter once a second when Windows Performance Monitor updates itself. You won't ever notice it, UNLESS you are running constant smooth animations.

If it were me, I'd have the animation only be run on a "mouse over", or some other way of not having this one animation constantly using a lot of Rainmeter's "bandwidth".

Rainmeter is fast and efficient, but it's a lot to ask to have it find, load and display a new 200x200 image once every 60 milliseconds. Fewer images per animation, so you can set Update higher, or not running the animation at all times, those can certainly help.

Don't want to discourage, and with some careful crafting and some thought about what other skins you are running, this might be just fine, but I can't promise that the result will be entirely satisfying, entirely smooth and seamless.
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: animated weather image

Post by xenium »

jsmorley wrote:I think you will want to look at something like this:

Code: Select all

[Rainmeter]
Author=xxenium
AppVersion=1.0
Update=60

[Variables]
UpdateRateSeconds=10000
FontFace=Subpear
URL=https://www.foreca.com/Argentine/Buenos_Aires?tenday
URL1=https://www.foreca.com/Argentine/Buenos_Aires

=============Measure=============

[MeasureName]
Measure=WebParser
Url=#URL#
RegExp="(?siU)<h1>(.*)</h1>.*"
UpdateRate=#UpdateRateSeconds#
Substitute="&deg;":""
StringIndex=1

[MeasureSymbol]
Measure=WebParser
Url=#URL1#
RegExp="(?siU)<div class="symbol_70x70.* symbol_(.*)_70x70 cc_symb".*"
StringIndex=1
UpdateRate=#UpdateRateSeconds#
FinishAction=[!EnableMeasureGroup Counters][!UpdateMeasure MeasureSetCounter]

[MeasureConditions]
Measure=WebParser
Url=#URL1#
RegExp="(?siU)<div class="right txt-tight">(.*)<br />.*"
UpdateRate=#UpdateRateSeconds#
StringIndex=1
RegExpSubstitute=1
Substitute="\t":"","#CRLF#":""

[MeasureSetCounter]
Measure=String
Group=Counters
String=[MeasureSymbol]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfMatch=(?i)d000
IfMatchAction=[!SetOption MeasureCounter Formula "Counter % 50"]
IfMatch2=(?i)d100
IfMatchAction2=[!SetOption MeasureCounter Formula "Counter % 20"]

[MeasureCounter]
Measure=Calc
Group=Counters
Disabled=1

==============Meter===================

[MeterImage]
Meter=Image
ImageName=#@#Images\[MeasureSymbol]\Frame[MeasureCounter].png
X=14
Y=35
DynamicVariables=1

[MeterName]
Meter=String
MeasureName=MeasureName
X=185
Y=45
W=190
H=50
FontColor=250,250,250,250
StringStyle=bold
StringEffect=SHADOW
FontFace=Subpear
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
ClipString=1
FontSize=12

[MeterConditions]
Meter=String
MeasureName=MeasureConditions
X=30
Y=80
W=200
H=150
FontColor=250,250,250,250
FontSize=22
FontFace=Calibri
StringStyle=BOLD
StringAlign=Left
StringEffect=SHADOW
FontEffectColor=0,0,0,80
ClipString=1
AntiAlias=1
So the point of this is to have "one" image meter, and just have it dynamically use the correct "path" based on the current weather conditions.

Now the second issue is that you have different numbers of images for different weather conditions. That means you need to adjust that "Counter" as well to match the conditions. That is what [MeasureSetCounter] is for.

If you look, I'm being careful not to have the skin doing more work than it has to at an Update of 60, as that is going to stress Rainmeter enough even when we are as efficient as we can be. I only update [MeasureSetCounter] once when the WebParser measure is done getting the conditions, and don't allow [MeasureCounter] to run at all until we have a value.

There will be a few initial errors in the log when you first load or refresh the skin, as WebParser won't have had time to go get the conditions, but the Image meter will be looking for a value for [MeasureSymbol]. That can be addressed, but I didn't think it was important enough to further complicate things just yet.

This is going to mean a boatload of IfMatch conditions on [MeasureSetCounter], which is unfortunate, but that is the price you are going to pay for not having all animations use a consistent number of images.

Let me know if you have any questions.
it works! :17good
thank you very much for your help and your recommendations :bow:
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: animated weather image

Post by jsmorley »

Glad to help.
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: animated weather image

Post by xenium »

jsmorley wrote:I think you will want to look at something like this:

Code: Select all

[Rainmeter]
Author=xxenium
AppVersion=1.0
Update=60

[Variables]
UpdateRateSeconds=10000
FontFace=Subpear
URL=https://www.foreca.com/Argentine/Buenos_Aires?tenday
URL1=https://www.foreca.com/Argentine/Buenos_Aires

=============Measure=============

[MeasureName]
Measure=WebParser
Url=#URL#
RegExp="(?siU)<h1>(.*)</h1>.*"
UpdateRate=#UpdateRateSeconds#
Substitute="&deg;":""
StringIndex=1

[MeasureSymbol]
Measure=WebParser
Url=#URL1#
RegExp="(?siU)<div class="symbol_70x70.* symbol_(.*)_70x70 cc_symb".*"
StringIndex=1
UpdateRate=#UpdateRateSeconds#
FinishAction=[!EnableMeasureGroup Counters][!UpdateMeasure MeasureSetCounter]

[MeasureConditions]
Measure=WebParser
Url=#URL1#
RegExp="(?siU)<div class="right txt-tight">(.*)<br />.*"
UpdateRate=#UpdateRateSeconds#
StringIndex=1
RegExpSubstitute=1
Substitute="\t":"","#CRLF#":""

[MeasureSetCounter]
Measure=String
Group=Counters
String=[MeasureSymbol]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfMatch=(?i)d000
IfMatchAction=[!SetOption MeasureCounter Formula "Counter % 50"]
IfMatch2=(?i)d100
IfMatchAction2=[!SetOption MeasureCounter Formula "Counter % 20"]

[MeasureCounter]
Measure=Calc
Group=Counters
Disabled=1

==============Meter===================

[MeterImage]
Meter=Image
ImageName=#@#Images\[MeasureSymbol]\Frame[MeasureCounter].png
X=14
Y=35
DynamicVariables=1

[MeterName]
Meter=String
MeasureName=MeasureName
X=185
Y=45
W=190
H=50
FontColor=250,250,250,250
StringStyle=bold
StringEffect=SHADOW
FontFace=Subpear
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
ClipString=1
FontSize=12

[MeterConditions]
Meter=String
MeasureName=MeasureConditions
X=30
Y=80
W=200
H=150
FontColor=250,250,250,250
FontSize=22
FontFace=Calibri
StringStyle=BOLD
StringAlign=Left
StringEffect=SHADOW
FontEffectColor=0,0,0,80
ClipString=1
AntiAlias=1
So the point of this is to have "one" image meter, and just have it dynamically use the correct "path" based on the current weather conditions.

Now the second issue is that you have different numbers of images for different weather conditions. That means you need to adjust that "Counter" as well to match the conditions. That is what [MeasureSetCounter] is for.

If you look, I'm being careful not to have the skin doing more work than it has to at an Update of 60, as that is going to stress Rainmeter enough even when we are as efficient as we can be. I only update [MeasureSetCounter] once when the WebParser measure is done getting the conditions, and don't allow [MeasureCounter] to run at all until we have a value.

There will be a few initial errors in the log when you first load or refresh the skin, as WebParser won't have had time to go get the conditions, but the Image meter will be looking for a value for [MeasureSymbol]. That can be addressed, but I didn't think it was important enough to further complicate things just yet.

This is going to mean a boatload of IfMatch conditions on [MeasureSetCounter], which is unfortunate, but that is the price you are going to pay for not having all animations use a consistent number of images.

Let me know if you have any questions.
Hello jsmorley,
It is possible that the errors mentioned by you above , not to be displayed in the log?

Thanks
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: animated weather image

Post by jsmorley »

xenium wrote:Hello jsmorley,
It is possible that the errors mentioned by you above , not to be displayed in the log?

Thanks
Can you .zip up the entire folder for this skin and host it somewhere that I can download it? I need the current skin and all the images in order to mess with it.
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: animated weather image

Post by xenium »

jsmorley wrote:Can you .zip up the entire folder for this skin and host it somewhere that I can download it? I need the current skin and all the images in order to mess with it.
https://www.deviantart.com/xxenium/art/LiveWeather-v3-0-745232397
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: animated weather image

Post by jsmorley »

I'm not getting any error messages, except the one you are explicitly logging.
1.jpg
2.jpg
You do not have the required permissions to view the files attached to this post.