It is currently April 18th, 2024, 10:40 pm

Animation... need little help...

Get help with creating, editing & fixing problems with skins
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Animation... need little help...

Post by brax64 »

Hi all,

I'm having a little issue with an animation I'm setting up in a weather skin.
Basically I'm moving up an image while fading 4 line of text (first 2 disappear and second 2 appear), wait 3 seconds and revert the process.
So i got the coding right to do exactly that, the only problem I have is if I hover the mouse again on the image when the cycle is running,
the whole thing get screwed...
Any hint will be much appreciated!

Cheers!
brax64

here is my code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
AntiAlias=1

[Variables]
U=[!UpdateMeasureGroup Weather][!UpdateMeterGroup Weather][!Redraw]
tAlpha=200
iAlpha=15
C=140,140,140
ff=Neon 80s
Degrees=°
img=#@#VClouds Weather Icons\0.png

;=======================================
;              Animation
;=======================================

[FadeAlpha]
Measure=Plugin
Plugin=ActionTimer
Group=Weather
ActionList1=In | Wait 50 | Repeat Rise,50,34
In=[!SetVariable iAlpha 15][!SetVariable tAlpha 200]#U#
Rise=[!SetVariable iAlpha (Min(#iAlpha#+7,255))][!SetVariable tAlpha (Max(#tAlpha#-6,0))]#U#
ActionList2=Wait 3000 | Repeat Fall,50,34 | Wait 50 | Out
Fall=[!SetVariable iAlpha (Max(#iAlpha#-7,15))][!SetVariable tAlpha (Min(#tAlpha#+6,200))]#U#
Out=[!SetVariable iAlpha 15][!SetVariable tAlpha 200]#U#
IgnoreWarnings=1
UpdateDivider=-1
DynamicVariables=1

[Transition]
Measure=Plugin
Plugin=ActionTimer
Group=Weather
ActionList1=Wait 300 | Repeat MoveUp,50,20
MoveUp=[!SetOption Icon Y (Clamp([Icon:Y]-1,130,150))]#U#
ActionList2=Wait 3800 | Repeat MoveDn,50,20
MoveDn=[!SetOption Icon Y (Clamp([Icon:Y]+1,130,150))]#U#
IgnoreWarnings=1
UpdateDivider=-1

[Icon]
Meter=Image
ImageName=#img#
SolidColor=0,0,0,1
Group=Weather
W=160
X=80
Y=150
PreserveAspectRatio=1
ImageAlpha=#iAlpha#
AntiAlias=1
DynamicVariables=1
MouseOverAction=[!CommandMeasure FadeAlpha "Execute 1"][!CommandMeasure Transition "Execute 1"][!CommandMeasure Transition "Stop 2"]
MouseLeaveAction=[!CommandMeasure FadeAlpha "Execute 2"][!CommandMeasure Transition "Execute 2"]

[Temp]
Meter=String
Group=Weather
X=175
Y=185
FontSize=18
FontFace=#ff#
AntiAlias=1
FontColor=#C#,#tAlpha#
SolidColor=0,0,0,1
StringAlign=Center
DynamicVariables=1
Text=31#Degrees#C

[Cond]
Meter=String
Group=Weather
X=r
Y=30r
FontSize=10
FontFace=#ff#
AntiAlias=1
FontColor=#C#,#tAlpha#
SolidColor=0,0,0,1
StringAlign=Center
DynamicVariables=1
Text=Thunderstorm

[Narative1]
Meter=String
Group=Weather
X=r
Y=20r
W=200
H=30
FontSize=10
FontFace=#ff#
AntiAlias=1
FontColor=#C#,(#iAlpha#-30)
SolidColor=0,0,0,1
StringAlign=Center
DynamicVariables=1
ClipString=1
Text=Partly cloudy. Highs 30 to 32. Lows 18 to 20
EDIT: Solved :lol:
Last edited by brax64 on August 5th, 2020, 2:46 am, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Animation... need little help...

Post by balala »

brax64 wrote: August 3rd, 2020, 4:16 am So i got the coding right to do exactly that, the only problem I have is if I hover the mouse again on the image when the cycle is running,
the whole thing get screwed...
At a first look, the problems are caused by the [!SetVariable iAlpha 15] bang of the In and Out options of the [FadeAlpha] plugin measure. First try out the code removing these bangs.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: Animation... need little help...

Post by brax64 »

balala wrote: August 3rd, 2020, 10:05 am At a first look, the problems are caused by the [!SetVariable iAlpha 15] bang of the In and Out options of the [FadeAlpha] plugin measure. First try out the code removing these bangs.
Hi balala,

Thanks for your quick reply,
well, did remove completely the In and Out functions from the FadeAlpha measure, now it is like this

Code: Select all

[FadeAlpha]
Measure=Plugin
Plugin=ActionTimer
Group=Weather
ActionList1=Wait 50 | Repeat Rise,50,34
Rise=[!SetVariable iAlpha (Min(#iAlpha#+7,255))][!SetVariable tAlpha (Max(#tAlpha#-6,0))]#U#
ActionList2=Wait 3000 | Repeat Fall,50,34 | Wait 50
Fall=[!SetVariable iAlpha (Max(#iAlpha#-7,15))][!SetVariable tAlpha (Min(#tAlpha#+6,200))]#U#
IgnoreWarnings=1
UpdateDivider=-1
DynamicVariables=1
and it's actually performing better, but still, if I hover the mouse more then once while the action timer are running, randomly I get weird result...
I'm assuming that might be due to the fact that every time the mouse get on the image, rainmeter is trying to execute again the timers and, perhaps, after few iterations can't keep up anymore...
so, at the end, is there any possibility to, so to speak, "disable" the mouse action till the cycle end?
Hope to have explained myself clealry ;)

Cheers!
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Animation... need little help...

Post by Mor3bane »

Hi Brax

I suppose you might know a bit so i will chance to suggest this:

Code: Select all

MouseOverAction=[Your code etc etc][!DisableMouseAction Meter, MouseAction(s), Config]
https://docs.rainmeter.net/manual/bangs/#DisableMouseAction
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: Animation... need little help...

Post by brax64 »

Mor3bane wrote: August 3rd, 2020, 12:52 pm Hi Brax

I suppose you might know a bit so i will chance to suggest this:

Code: Select all

MouseOverAction=[Your code etc etc][!DisableMouseAction Meter, MouseAction(s), Config]
https://docs.rainmeter.net/manual/bangs/#DisableMouseAction
Hi Mo3bane,

Thanks for your tip, I've missed that!
Yeah !DisableMouseAction it might do the trick, but I need to create a sort of "timer" to re enable the mouse again once the action timers have done their job.
I'm thinking something like

Code: Select all

[Cycle]
Measure=Calc
Formula=(Cycle+1)%(#maxcycle1#+1)
IfEqualValue=#maxcycle#
IfEqualAction=[!EnableMouseAction MyMeter "MouseOverAction"]
UpdateDivider=1
It might works but I need to test it and figure out exactly how to implement that...
Please let me know if this approach could be the right path or if you know a better solution, thank you!

Cheers!
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Animation... need little help...

Post by balala »

brax64 wrote: August 3rd, 2020, 4:00 pm I'm thinking something like

Code: Select all

[Cycle]
Measure=Calc
Formula=(Cycle+1)%(#maxcycle1#+1)
IfEqualValue=#maxcycle#
IfEqualAction=[!EnableMouseAction MyMeter "MouseOverAction"]
UpdateDivider=1
It might works but I need to test it and figure out exactly how to implement that...
Please let me know if this approach could be the right path or if you know a better solution, thank you!
Not sure such a measure is needed. Maybe a !Delay bang should do the job (however I'm not sure right now).
Please post the latest code you're working with (even if the original code has been posted) and let me know what is right now the issue with it.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: Animation... need little help...

Post by brax64 »

balala wrote: August 3rd, 2020, 5:34 pm Not sure such a measure is needed. Maybe a !Delay bang should do the job (however I'm not sure right now).
Please post the latest code you're working with (even if the original code has been posted) and let me know what is right now the issue with it.
Hi balala,
this is the actual state of my code

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
AntiAlias=1

[Variables]
U=[!UpdateMeasureGroup Weather][!UpdateMeterGroup Weather][!Redraw]
tAlpha=200
iAlpha=15
C=140,140,140
ff=Neon 80s
Degrees=°
img=#@#VClouds Weather Icons\0.png
maxcycle=4

;=======================================
;              Animation
;=======================================

[Cycle]
Measure=Calc
Formula=(Cycle+1)%(#maxcycle#+1)
IfEqualValue=#maxcycle#
IfEqualAction=[!EnableMouseAction Icon "MouseOverAction"][!PauseMeasure "Cycle"]

[FadeAlpha]
Measure=Plugin
Plugin=ActionTimer
Group=Weather
ActionList1=Wait 50 | Repeat Rise,50,34
Rise=[!SetVariable iAlpha (Min(#iAlpha#+7,255))][!SetVariable tAlpha (Max(#tAlpha#-6,0))]#U#
ActionList2=Wait 3000 | Repeat Fall,50,34
Fall=[!SetVariable iAlpha (Max(#iAlpha#-15,15))][!SetVariable tAlpha (Min(#tAlpha#+10,200))]#U#
IgnoreWarnings=1
UpdateDivider=-1
DynamicVariables=1

[Transition]
Measure=Plugin
Plugin=ActionTimer
Group=Weather
ActionList1=Wait 300 | Repeat MoveUp,40,20
MoveUp=[!SetOption Icon Y (Clamp([Icon:Y]-1,130,150))]#U#
ActionList2=Wait 3000 | Repeat MoveDn,50,20
MoveDn=[!SetOption Icon Y (Clamp([Icon:Y]+1,130,150))]#U#
IgnoreWarnings=1
UpdateDivider=-1

[Icon]
Meter=Image
ImageName=#img#
SolidColor=0,0,0,1
Group=Weather
W=160
X=80
Y=150
PreserveAspectRatio=1
ImageAlpha=#iAlpha#
AntiAlias=1
DynamicVariables=1
MouseOverAction=[!CommandMeasure FadeAlpha "Execute 1"][!CommandMeasure Transition "Execute 1"][!CommandMeasure Transition "Stop 2"][!DisableMouseAction Icon "MouseOverAction"][!UnpauseMeasure "Cycle"]
MouseLeaveAction=[!CommandMeasure FadeAlpha "Execute 2"][!CommandMeasure Transition "Execute 2"]

[Temp]
Meter=String
Group=Weather
X=175
Y=185
FontSize=18
FontFace=#ff#
AntiAlias=1
FontColor=#C#,#tAlpha#
SolidColor=0,0,0,1
StringAlign=Center
DynamicVariables=1
Text=31#Degrees#C

[Cond]
Meter=String
Group=Weather
X=r
Y=30r
FontSize=10
FontFace=#ff#
AntiAlias=1
FontColor=#C#,#tAlpha#
SolidColor=0,0,0,1
StringAlign=Center
DynamicVariables=1
Text=Thunderstorm

[Narative1]
Meter=String
Group=Weather
X=r
Y=20r
W=200
H=30
FontSize=10
FontFace=#ff#
AntiAlias=1
FontColor=#C#,(#iAlpha#-53)
SolidColor=0,0,0,1
StringAlign=Center
DynamicVariables=1
ClipString=1
Text=Partly cloudy. Highs 30 to 32. Lows 18 to 20
also here a short video that might help to understand what's happening, basically if I hover with the mouse while the timers are running, randomly the cycle do not complete properly...
https://1drv.ms/v/s!AqHC35yPJbKOgYJ0ec6pfRfjDQYP7A?e=obe4i3

Thank you very much for your help!

Cheers!
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Animation... need little help...

Post by balala »

brax64 wrote: August 3rd, 2020, 6:05 pm this is the actual state of my code
I'd try to add a few !CommandMeasure bangs into the MouseOverAction and MouseLeaveAction options of the [Icon] meter, to stop the started action. For instance when you're hovering the mouse over the meter, you get executed the first action of the [FadeAlpha] measure (through the [!CommandMeasure FadeAlpha "Execute 1"] bang), but this action is never stopped. If you keep the mouse over the meter for enough time to get finished the increase of the iAlpha variable, this is ok, but if you're leaving the meter too soon, you get executed both actions of the [FadeAlpha] measure, because the first one is not yet finished and is never stopped, while the second one is already started by the first !CommandMeasure bang of the MouseLeaveAction option of the [Icon] meter.
There is a simple solution: add the missing bangs:

Code: Select all

[Icon]
...
MouseOverAction=[!CommandMeasure FadeAlpha "Execute 1"][!CommandMeasure FadeAlpha "Stop 2"][!CommandMeasure Transition "Execute 1"][!CommandMeasure Transition "Stop 2"][!DisableMouseAction Icon "MouseOverAction"][!UnpauseMeasure "Cycle"]
MouseLeaveAction=[!CommandMeasure FadeAlpha "Execute 2"][!CommandMeasure FadeAlpha "Stop 1"][!CommandMeasure Transition "Execute 2"][!CommandMeasure Transition "Stop 1"]
(above I also added a !CommandMeasure bang to stop the first action of the [Transition] measure when you're leaving the meter).
Have this fixed the issue?
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: Animation... need little help...

Post by brax64 »

balala wrote: August 3rd, 2020, 7:01 pm I'd try to add a few !CommandMeasure bangs into the MouseOverAction and MouseLeaveAction options of the [Icon] meter, to stop the started action. For instance when you're hovering the mouse over the meter, you get executed the first action of the [FadeAlpha] measure (through the [!CommandMeasure FadeAlpha "Execute 1"] bang), but this action is never stopped. If you keep the mouse over the meter for enough time to get finished the increase of the iAlpha variable, this is ok, but if you're leaving the meter too soon, you get executed both actions of the [FadeAlpha] measure, because the first one is not yet finished and is never stopped, while the second one is already started by the first !CommandMeasure bang of the MouseLeaveAction option of the [Icon] meter.
There is a simple solution: add the missing bangs:

Code: Select all

[Icon]
...
MouseOverAction=[!CommandMeasure FadeAlpha "Execute 1"][!CommandMeasure FadeAlpha "Stop 2"][!CommandMeasure Transition "Execute 1"][!CommandMeasure Transition "Stop 2"][!DisableMouseAction Icon "MouseOverAction"][!UnpauseMeasure "Cycle"]
MouseLeaveAction=[!CommandMeasure FadeAlpha "Execute 2"][!CommandMeasure FadeAlpha "Stop 1"][!CommandMeasure Transition "Execute 2"][!CommandMeasure Transition "Stop 1"]
(above I also added a !CommandMeasure bang to stop the first action of the [Transition] measure when you're leaving the meter).
Have this fixed the issue?
No, in this way is not working, I had already tried before.
Having [!CommandMeasure Transition "Stop 1"] in the MouseLeaveAction, if you move the mouse away from the image while the [!CommandMeasure Transition "Execute 1"] in the MouseOverAction is still running, the cycle stops prematurely, and even if you leave the mouse on the image, it complete the MoveUp action and then is sitting there waiting for the MouseLeaveAction get triggered...

EDIT: Forgot to mention that the [FadeAlpha] is working fine without stopping it...
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Animation... need little help...

Post by balala »

brax64 wrote: August 3rd, 2020, 7:34 pm No, in this way is not working, I had already tried before.
Well, I'm extremely surprised, because it definitely does work well for me (I replaced the Image meter with a solid semi-transparent red rectangle and also added a String meter into the upper left corner, to can follow how the variables / options are changing):
GIF.gif
You do not have the required permissions to view the files attached to this post.