It is currently September 8th, 2024, 2:42 am

Meter/Variable Fade Bang

Report bugs with the Rainmeter application and suggest features.
User avatar
UnstoppableDave
Posts: 30
Joined: May 22nd, 2010, 6:51 pm

Meter/Variable Fade Bang

Post by UnstoppableDave »

A bang or something that would fade a variable over time would be very useful. Such as:
[!RainmeterFadeVariable ImageAlpha 0 255 300]

So fade variable imagealpha from 0 to 255 in 300 ms?

Anyone else see use for this?
Would it even be possible?

Dave
Image
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Meter/Variable Fade Bang

Post by JpsCrazy »

I'd really like this as well.
Probably a Meter and not variable though. :P
Good suggestion!
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Meter/Variable Fade Bang

Post by Chewtoy »

I think you can make this today. If yet a little tidious.
We got !RainmeterSetVariable, so it's basically to set a variable, say variable Alpha. Let me show you what I think.

Code: Select all

[Rainmeter]
Update=#Update#

[Variables]
Update=300
Alpha=255
FontColor=255, 255, 255, #Alpha#

[CountAlpha]
Measure=Calc
Formula=counter%255

[SetAlpha]
Measure=Calc
Formula=Counter%2
IfBelowValue=1
IfBelowAction=!Execute [!RainmeterSetVariable Alpha [CountAlpha]]
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterSetVariable Alpha [CountAlpha]]
DynamicVariables=1

[Text]
Meter=String
X=2
Y=2
FontColor=#FontColor#
FontSize=8
FontFace=Tahoma
DynamicVariables=1
I think that should work. But it is indeed a lot more work than you want. And it updates ever 300ms. So, yeah. It's a way to do what you want, but it takes more than what you ask.
I don't think, therefore I'm not.
User avatar
UnstoppableDave
Posts: 30
Joined: May 22nd, 2010, 6:51 pm

Re: Meter/Variable Fade Bang

Post by UnstoppableDave »

Thanks for that code, but I'm... not seeing how that works. It doesn't work as it is, and I can't seem to adapt it to work. Sorry if I overlooked something in my inexperience. :|

I have a way to do it using calcs that mostly works ok, but I guess my question is, can you smoothly fade anything, like a variable, and update the meter smoothly without lowering to update value to crazy low?

Dave
Image
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Meter/Variable Fade Bang

Post by Chewtoy »

Ah well. Didn't test the code. So it might very well be wrong (wasn't in the position of testing while I wrote it).

For anything to happen "smoothly" in rainmeter, we need a fairly low update. Update tells how often to run the skin, updating the code that you enabled.
So, the shor answer is. No. No we can't.
The longer answer: The entire skin is dependent on the update-frequency. It tells how often things should be re-run. Like calcs and updates of text. Or where a text should be. Something can't update faster than it's being read. It's like trying to read 20pages in 1minute when you only can read 10pages/minute.
I don't think, therefore I'm not.
User avatar
Varelse
Posts: 61
Joined: April 22nd, 2009, 7:46 pm

Re: Meter/Variable Fade Bang

Post by Varelse »

I think this should work.

Code: Select all

[Variables]
FontColor=255, 255, 255

[Rainmeter]
Update=300

[CountAlpha]
Measure=Calc
Formula=Counter%255

[Text]
Meter=String
X=2
Y=2
FontColor=#FontColor#,[CountAlpha]
FontSize=8
FontFace=Tahoma
DynamicVariables=1
It's quite easy to use different formula's like (Counter%51)*5 which will change the color from a transparceny of 0 to 255 in 5 updates.