It is currently March 29th, 2024, 9:09 am

Action Timer stopping animation after turning off the display

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Action Timer stopping animation after turning off the display

Post by Yincognito »

I have this basic skin that I use to get accustomed with ActionTimer, in the hope that I would be able to convert some of my skins to using it (in order to avoid a short skin update rate flickering my tooltips). It's taken from raiguard's post in "Tips & Tricks" and adapted a little bit:

Code: Select all

[Rainmeter]
AccurateText=1
OnRefreshAction=[!CommandMeasure MeasureActionTimer "Execute 1"]

[Variables]
text="Wed, 00 May 2020   ●   ‒000 °C   ●   Showers Early / Clearing Late"
animationSpeed=24
marqueeBeginWait=1500
marqueeEndWait=1500
marquee=0

[MeasureMarqueeOffset]
Measure=Calc
Formula=max(0,([MeterText:W] - [MeterTextContainer:W]))
DynamicVariables=1

[MeasureActionTimer]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Move1,#animationSpeed#,[MeasureMarqueeOffset:] | Wait #marqueeEndWait# | Reset1 | Wait #marqueeBeginWait# | DoOver1
Reset1=[!SetVariable marquee 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter MeterText][!Redraw]
Move1=[!SetVariable marquee "(#marquee# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter MeterText][!Redraw]
DoOver1=[!CommandMeasure MeasureActionTimer "Execute 1"]
DynamicVariables=1

[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,168,13 | StrokeWidth 0.5 | Stroke Color 255,64,32 | Fill Color 32,32,32,128

[MeterTextContainer]
Meter=Image
SolidColor=255,255,255,255
X=31
Y=0
W=136
H=13

[MeterTitle]
Meter=String
ClipString=2
FontFace=Tahoma
FontSize=7
AntiAlias=1
FontWeight=700
FontColor=255,255,255,255
StringEffect=Shadow
FontEffectColor=0,0,0,255
X=2
Y=0
Text=WEA

[MeterText]
Meter=String
Container=MeterTextContainer
FontFace=Tahoma
FontSize=7
FontWeight=400
FontColor=160,255,160,255
FontEffectColor=0,0,0,255
StringEffect=Shadow
Antialias=1
ClipString=0
InlineSetting=Color | 128,255,255,255
InlinePattern="^([^●]*)   ●"
InlineSetting2=Color | 255,255,255,255
InlinePattern2="(   ●   )"
InlineSetting3=Color | 255,224,128,255
InlinePattern3="●   ([^●]*)$"
X=#marquee#
Y=0
Text=#text#
DynamicVariables=1
This works fine, but after the automatic Windows process of turning off the display to save power, the animation stops - I have to refresh the skin to start it over again. Is this normal, and if it isn't how can it be avoided? I want the animation to persist no matter what, the same way it persists when doing it the "old way" (i.e. by using a "counter" Calc measure in a rapidly updated skin).

EDIT: After further investigation, it appeared that the issue had nothing to do with turning off the display, but it would happen even when the display kept being on. After checking the log, I noticed an 'ActionList1' is currently running (Marquee\Marquee.ini - [MeasureActionTimer]) message, so I added [!CommandMeasure MeasureActionTimer "Stop 1"] as the first bang in DoOver1 and it appeared to solve the problem. However, doesn't this have the potential of halting a not yet finished ActionList1? Something like starting the next animation iteration before the current one finished sliding the text completely?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

Since DoOver1 is a part of ActionList1, you initially created an error condition, since only one instance of ActionList1 can be running at a time. Using "Stop" is the only reliable way to do this.

ActionList1 is not "complete" until DoOver1 is complete. See the conundrum? The "Stop" will interrupt ActionList1 and allow subsequent bangs in DoOver1 to be executed, they are already queued up to go.

ActionTimer is not intended, nor particularly designed, to support never-ending animations. It can be done, but it's up to you to think it through and design it carefully... A never-ending animation can easily overwhelm the Rainmeter message queue if you are not careful, and that can have really ugly results. You have to give Rainmeter some time to breathe. Redraw is not inexpensive...

There are lots of ways to come at this. You might have two ActionTimer measures, where one hands over to the other, and then that one hands back to the first. It depends a lot on what you are doing and the visible effect you are going for.

https://docs.rainmeter.net/manual/plugins/actiontimer/#ImportantNote
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Action Timer stopping animation after turning off the display

Post by Yincognito »

jsmorley wrote: February 17th, 2020, 2:04 pm Since DoOver1 is a part of ActionList1, you initially created an error condition, since only one instance of ActionList1 can be running at a time. Using "Stop" is the only reliable way to do this.

ActionList1 is not "complete" until DoOver1 is complete. See the conundrum? The "Stop" will interrupt ActionList1 and allow subsequent bangs in DoOver1 to be executed, they are already queued up to go.

ActionTimer is not intended, nor particularly designed, to support never-ending animations. It can be done, but it's up to you to think it through and design it carefully... ;-)

https://docs.rainmeter.net/manual/plugins/actiontimer/#ImportantNote
Thank you for the explanation - I get what you mean. I know about the note, but then, that's the only way of keeping a short update rate out of Rainmeter "proper". This time I can't hide all the tooltip info in the skin itself (like I did in the case of my feeds skin) - I want them to stay in the tooltip and that the tooltip doesn't flicker due to the short update rate.

That being said, I've already encountered some frozen instances of Rainmeter while testing. I don't know if it's because my sloppy code using ActionTimer, the warning in the note (yet the moving part is so small, it shouldn't happen) or the new beta version of Rainmeter I just installed recently. Here is my code - I want to slide the text endlessly, and yes, sliding out of view before reentering the viewport is intentional - maybe you can figure out better what's wrong with it and why freezing happens after a while (if you can reproduce it, that is):

Code: Select all

[Rainmeter]
AccurateText=1
OnRefreshAction=[!CommandMeasure MeasureActionTimer "Execute 1"]

[Variables]
ContainerWidth=136
TextWidth=0
Counter=0
CurrentStep=1
SlidingUpdate=24
Text="Wed, 00 May 2020   ●   ‒000 °C   ●   Showers Early / Clearing Late"

---Measures---

[MeasureActionTimer]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Move1,(#SlidingUpdate#),(#ContainerWidth#+#TextWidth#) | Wait (#SlidingUpdate#) | DoOver1
Move1=[!SetVariable Counter "((#Counter#<0)?(#ContainerWidth#+#TextWidth#):((#Counter#>(#ContainerWidth#+#TextWidth#))?(0):(#Counter#+#CurrentStep#)))"][!UpdateMeasure MeasureActionTimer][!SetOption MeterText X "(#ContainerWidth#-#Counter#)"][!UpdateMeter *][!Redraw]
DoOver1=[!CommandMeasure MeasureActionTimer "Stop 1"][!CommandMeasure MeasureActionTimer "Execute 1"]
DynamicVariables=1

---Meters---

[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,168,13 | StrokeWidth 0.5 | Stroke Color 255,64,32 | Fill Color 32,32,32,128
UpdateDivider=-1

[MeterTitle]
Meter=String
ClipString=2
FontFace=Tahoma
FontSize=7
AntiAlias=1
FontWeight=700
FontColor=255,255,255,255
StringEffect=Shadow
FontEffectColor=0,0,0,255
X=2
Y=0
Text=WEA
UpdateDivider=-1

[MeterContainer]
Meter=Shape
X=31
Y=0
Shape=Rectangle 0,0,136,13 | Fill Color 0,0,0,255 | StrokeWidth 0
UpdateDivider=-1

[MeterText]
Meter=String
Container=MeterContainer
FontFace=Tahoma
FontSize=7
FontWeight=400
FontColor=160,255,160,255
FontEffectColor=0,0,0,255
StringEffect=Shadow
Antialias=1
ClipString=0
InlineSetting=Color | 128,255,255,255
InlinePattern="^([^●]*)   ●"
InlineSetting2=Color | 255,255,255,255
InlinePattern2="(   ●   )"
InlineSetting3=Color | 255,224,128,255
InlinePattern3="●   ([^●]*)$"
X=(#ContainerWidth#/2)
Y=0
Text=#Text#
UpdateDivider=-1
OnUpdateAction=[!SetVariable TextWidth [MeterText:W]]
DynamicVariables=1
Sorry for bothering you with things you don't particularily like. I'm embarassed myself that after all this time I still ask for advice for something that should be that simple. :oops:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

You can't use (formulas) in an ActionList(N) option.

ActionList1=Repeat Move1,#SlidingUpdate#,136 | Wait #SlidingUpdate# | DoOver1

Seems to work fine for me.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

Code: Select all

[ContainerWidthCalc]
Measure=Calc
Formula=#ContainerWidth#+#TextWidth#

[MeasureActionTimer]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Move1,#SlidingUpdate#,[ContainerWidthCalc] | Wait #SlidingUpdate# | DoOver1
Move1=[!SetVariable Counter "((#Counter#<0)?(#ContainerWidth#+#TextWidth#):((#Counter#>(#ContainerWidth#+#TextWidth#))?(0):(#Counter#+#CurrentStep#)))"][!UpdateMeasure MeasureActionTimer][!SetOption MeterText X "(#ContainerWidth#-#Counter#)"][!UpdateMeter *][!Redraw]
DoOver1=[!CommandMeasure MeasureActionTimer "Stop 1"][!CommandMeasure MeasureActionTimer "Execute 1"]
DynamicVariables=1
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

I would be very tempted to have a short "wait" at the beginning of ActionList1 to give that "Stop" time to work...

Code: Select all

[MeasureActionTimer]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Wait 10 | Repeat Move1,#SlidingUpdate#,[ContainerWidthCalc] | Wait #SlidingUpdate# | DoOver1
Move1=[!SetVariable Counter "((#Counter#<0)?(#ContainerWidth#+#TextWidth#):((#Counter#>(#ContainerWidth#+#TextWidth#))?(0):(#Counter#+#CurrentStep#)))"][!UpdateMeasure MeasureActionTimer][!SetOption MeterText X "(#ContainerWidth#-#Counter#)"][!UpdateMeter *][!Redraw]
DoOver1=[!CommandMeasure MeasureActionTimer "Stop 1"][!CommandMeasure MeasureActionTimer "Execute 1"]
DynamicVariables=1
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

And yeah, Rainmeter will become unresponsive after a while of running this. Not really sure why...

Doesn't seem to be any particular amount of time. No doubt it has to do with some collision between what the ActionTimer is trying to force Rainmeter to do while it is busy doing something else, maybe while it is in the middle of another "threaded" measure, like WebParser.

I really think perhaps the "handover" approach I talked about above might be better...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

And yes, I really hate this... ;-)

It causes Rainmeter to like double the amount of CPU it is using, and for what? This annoying little fly buzzing around on my screen all the time?
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Action Timer stopping animation after turning off the display

Post by Yincognito »

jsmorley wrote: February 17th, 2020, 2:50 pm You can't use (formulas) in an ActionList(N) option.

ActionList1=Repeat Move1,#SlidingUpdate#,136 | Wait #SlidingUpdate# | DoOver1

Seems to work fine for me.
Oh, I see. Well, this little detail regarding formula restriction isn't in the manual, so...
One other thing I noticed: are the quotes in the actions' bangs required? I saw them used in the "Tips & Tricks" sample, but I don't generally use them for numeric / formula SetOption.

Just prepared to write that it works fine for me as well, until I got another freeze. I'm also using a "classic" slide in another skin, by the way - but that worked fine for years now.
Skin Set.jpg
EDIT: Yes, moving the formula in a Calc measure is a reasonable workaround for this restriction. :thumbup:
jsmorley wrote: February 17th, 2020, 3:06 pm And yes, I really hate this... ;-)

It causes Rainmeter to like double the amount of CPU it is using, and for what? This annoying little fly buzzing around on my screen all the time?
It doesn't significantly affect the CPU in my case. Actually, it's the same CPU usage as before: 0.38% to 1.19% for Rainmeter, at 2.30 Gz frequency. In fact, the freeze happened at 0% Rainmeter CPU usage... :???:
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

Been running for a while now without any "hang", but I suspect it will sooner or later. I have no idea what "alignment of planets" causes it, but I would certainly consider this fatally unreliable.