It is currently March 29th, 2024, 12:30 pm

/

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Animation] Pause to Unpose after X time

Post by balala »

I'd modify / add a few options, replacing the [ImageNumberCalc] measure with the following one:

Code: Select all

[ImageNumberCalc]
Measure=Calc
Formula=( ImageNumberCalc + 2 )
IfCondition=(#CURRENTSECTION#=48)
IfTrueAction=[!PauseMeasure "#CURRENTSECTION#"][!Delay "60000"][!UnpauseMeasure "#CURRENTSECTION#"]
IfCondition2=(#CURRENTSECTION#>=96)
IfTrueAction2=[!DisableMeasure "#CURRENTSECTION#"]
Take care the followings:
  • The [!Delay "60000"] bang sets the length of the pause (in milliseconds). That's why I've set there 60000. You can easily modify it, if you want another length of the pause.
  • The IfConditions set when the measure is paused / finished. When finished, it is disabled. You can re-enable it through a click to some meter and in such case, the animation starts again, from the beginning (adding a LeftMouseUpAction=[!EnableMeasure "ImageNumberCalc"] option to the appropriate meter, which starts over again the animation).
  • Instead of a such low Update value (which isn't a good idea, due to the increasing resource - CPU - usage), I'd use the ActionTimer plugin. It should have to be run ONLY while the animation is running.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Animation] Pause to Unpose after X time

Post by balala »

ColorCode wrote:What if replace "pause time" (60 seconds) with a solid color.
Well, I didn't understand this! You would like to replace the the whole skin with a black solid color, while the measure is paused?
ColorCode wrote:But, since the animation is a separate animation.ini which runs every 20 minutes for 60 seconds do I need that?
Exactly this is why you need it, in my opinion. There is no good reason to continuously run a skin with a such low Update value for 20 seconds, when the animation is hidden.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Animation] Pause to Unpose after X time

Post by balala »

I rewrote your code, to use the ActionTimer plugin. In such cases it is an extremely useful plugin. The [AnimationStartBG] Image meter now works not with a measure, but with a variable.
Please test this code and let me know if it does work for you:

Code: Select all

[Rainmeter]
Update=-1
OnRefreshAction=[!CommandMeasure "ImageNumberCalc" "Execute 1"][!ZPos 2]

[Variables]
Step=0
Wait=0
WaitTime=60
U=[!UpdateMeasure "ImageNumberCalc"][!UpdateMeter "AnimationStartBG"][!Redraw]

[ImageNumberCalc]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Up,20,24
Up=[!SetVariable Step "(Clamp((#Step#+2),0,48))"]#U#
ActionList2=Repeat Down,20,24
Down=[!SetVariable Step "(Clamp((#Step#-2),0,48))"]#U#
ActionList3=Repeat Pause,1000,#WaitTime#
Pause=[!SetVariable Wait "(Clamp((#Wait#+1),0,#WaitTime#))"]#U#
DynamicVariables=1
IfCondition=(#Step#=48)
IfTrueAction=[!CommandMeasure "ImageNumberCalc" "Stop 1"][!CommandMeasure "ImageNumberCalc" "Stop 2"][!CommandMeasure "ImageNumberCalc" "Execute 3"]
IfCondition2=(#Wait#=#WaitTime#)
IfTrueAction2=[!SetVariable Wait "0"][!CommandMeasure "ImageNumberCalc" "Stop 1"][!CommandMeasure "ImageNumberCalc" "Execute 2"][!CommandMeasure "ImageNumberCalc" "Stop 3"]
IfCondition3=(#Step#=0)
IfTrueAction3=[!CommandMeasure "ImageNumberCalc" "Stop 1"][!CommandMeasure "ImageNumberCalc" "Stop 2"][!CommandMeasure "ImageNumberCalc" "Stop 3"]

[AnimationStartBG]
Meter=Image
X=0
Y=0
W=#SCREENAREAWIDTH#
H=#SCREENAREAHEIGHT#
ImageName=#@#Frames\Frame#Step#.png
DynamicVariables=1
Note the followings:
  • The Update value of this code is -1. This means the skin isn't updated at all (just in the very first moment, when it is refreshed / loaded). This way the skin is much less "hungry", regarding the CPU usage.
  • Obviously the WaitTime variable (set up in the [Variables] section) is the period while the animation is paused, when it is (expressed in seconds). Change it if you need to.
  • The Step and Wait variables are used by the code, you don't have to take care of them.
  • The !Execute bang (which you've used in the OnRefreshAction option of the [Rainmeter] section) is deprecated and should have to be removed. I did it.
Does this code work as you would like?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Animation] Pause to Unpose after X time

Post by balala »

ColorCode wrote:Would you try your hand at this EyeCare Skin?
There are three configs. What you would like me to do with them?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Animation] Pause to Unpose after X time

Post by balala »

I load EyeCareWorkTime. It starts count down and after 10 seconds, it loads the FP-RestAnimation. It also counts down and after it reaches 0 it is unloaded but the EyeCareWorkTime starts counting down again. When it reaches 0, FP-RestAnimation is reloaded. Then everything starts all over again: FP-RestAnimation loads EyeCareWorkTime and this one loads FP-RestAnimation and so on.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Animation] Pause to Unpose after X time

Post by balala »

ColorCode wrote:What about the animation? Does it play for you?
Partially. The FP-RestAnimation just grows up, stops then closes. The backward animation doesn't play. Should it?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Animation] Pause to Unpose after X time

Post by balala »

And one more detail, I just saw: unlike the !ActivateConfig bang, the !DeactivateConfig doesn't need two parameters. The name of the config is completely enough.
Eg in the OnRefreshAction option ([Rainmeter] section) of the EyeCareRestTime.ini skin you have the following bang: [!DeactivateConfig "EyeCareScreenSaver" [color=#FF0000]"EyeCareScreenSaver.ini"[/color]]. The red part of this bang isn't needed. If you tell Rainmeter what config it has to close (deactivate), it knows which skin of that config is loaded and will unload that one. So the correct form of that bang would be: [!DeactivateConfig "EyeCareScreenSaver"]. I know even the first form of the bang is working, but correctly it shouldn't have to have that form.
ColorCode wrote:Sorry, my fault. See post above.
Checking immediately...
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Animation] Pause to Unpose after X time

Post by balala »

ColorCode wrote:Sorry, my fault. See post above.
Ok, I did copy the new measure, but the animation still isn't working perfectly: the black patch grows, the countdown starts and when it reaches 0, the patch starts to decrease, but before it would finish this decreasing, it is closed.
The solution I think would be to increase the IfAboveValue of the [AnimationOffDelay] measure of the EyeCareWorkTime.ini skin. I tried with IfAboveValue=6 and this seems to be all right.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Animation] Pause to Unpose after X time

Post by jsmorley »

This plugin can be a big help with detecting if a skin is "active" or not.

https://forum.rainmeter.net/viewtopic.php?p=141968#p141968
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Animation] Pause to Unpose after X time

Post by balala »

ColorCode wrote:Despite having 9 year old laptop, It runs smoothly for me.
It ran smoothly, not this was the problem. The problem was that the animation wasn't finished, being interrupted before it got finish. As I said, replacing the IfAboveValue fixed the issue.