It is currently April 26th, 2024, 11:56 am

Help with fader in ActionTimer!

Get help with creating, editing & fixing problems with skins
User avatar
andersonventura
Posts: 57
Joined: December 11th, 2018, 7:38 pm
Location: Brasil

Help with fader in ActionTimer!

Post by andersonventura »

Hello, friends!

First of all, I'm new to the forum and programming with rainmeter. I'm from Brazil and my English writing is very bad. Sorry...

I'm trying to program a skin and I'm having troubles. I'm based on several posts here in the forum as well as skins that I'm downloading on the internet.

Until now I have been able to make the images fadein on mouseover. however, only works when the mouse comes from outside the skin. when I am inside the skin and I direct the mouse to the next image the effect does not work.

Help me with what I'm missing!
Here's the code:

Code: Select all

[Rainmeter]
Update=1
SkinWidth=1920
SkinHeight=1080

[Variables]
Alpha=1
Wait=8
U=[!UpdateMeasure Fader][!UpdateMeter *][!Redraw]

[Fader]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat FadeIn,#Wait#,51
FadeIn=[!SetVariable Alpha "(Clamp(#Alpha#+5,1,255))"]#U#
ActionList2=Repeat FadeOut,#Wait#,51
FadeOut=[!SetVariable Alpha "(Clamp(#Alpha#-5,1,255))"]#U#
DynamicVariables=1

[Slice_01]
Meter=Image
Group=Slices
ImageName=#@#slice_01.png
X=0
Y=0
ImageAlpha=#Alpha#
MouseOverAction=[!SetOptionGroup Slices ImageAlpha 1][!SetOption Slice_01 ImageAlpha "#*Alpha*#"][!CommandMeasure Fader "Stop 2"][!CommandMeasure Fader "Execute 1"]
MouseLeaveAction=[!SetOptionGroup Slices ImageAlpha 1][!SetOption Slice_01 ImageAlpha "#*Alpha*#"][!CommandMeasure Fader "Stop 1"][!CommandMeasure Fader "Execute 2"]
DynamicVariables=1

[Slice_02]
Meter=Image
Group=Slices
ImageName=#@#slice_02.png
X=96
Y=0
ImageAlpha=#Alpha#
MouseOverAction=[!SetOptionGroup Slices ImageAlpha 1][!SetOption Slice_02 ImageAlpha "#*Alpha*#"][!CommandMeasure Fader "Stop 2"][!CommandMeasure Fader "Execute 1"]
MouseLeaveAction=[!SetOptionGroup Slices ImageAlpha 1][!SetOption Slice_02 ImageAlpha "#*Alpha*#"][!CommandMeasure Fader "Stop 1"][!CommandMeasure Fader "Execute 2"]
DynamicVariables=1
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with fader in ActionTimer!

Post by jsmorley »

We don't have your images, so it's hard to test, but I'm quite sure that what is happening is that those image meters overlay each other. That will completely confuse the "mouse over / mouse leave" stuff, as the mouse will be detected by both image meters.
User avatar
andersonventura
Posts: 57
Joined: December 11th, 2018, 7:38 pm
Location: Brasil

Re: Help with fader in ActionTimer!

Post by andersonventura »

Image
Image


A short video:
https://youtu.be/mru2zDSSs1s

I'm planning to make a background that changes the color on mouseover. for now I'm working with slices of 96x108 but if I can make the effect work, I will reduce the size of the slices.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with fader in ActionTimer!

Post by jsmorley »

So the issue is that you are using the same "fader", or more to the point the same "variable" for both images, and that is creating a conflict. If you separate them:

Code: Select all

[Rainmeter]
Update=1
SkinWidth=1920
SkinHeight=1080

[Variables]
Alpha1=1
Alpha2=1
Wait=8
U=[!UpdateMeasure Fader][!UpdateMeter *][!Redraw]

[Fader]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat FadeIn1,#Wait#,51
FadeIn1=[!SetVariable Alpha1 "(Clamp(#Alpha1#+5,1,255))"]#U#
ActionList2=Repeat FadeOut1,#Wait#,51
FadeOut1=[!SetVariable Alpha1 "(Clamp(#Alpha1#-5,1,255))"]#U#
ActionList3=Repeat FadeIn2,#Wait#,51
FadeIn2=[!SetVariable Alpha2 "(Clamp(#Alpha2#+5,1,255))"]#U#
ActionList4=Repeat FadeOut2,#Wait#,51
FadeOut2=[!SetVariable Alpha2 "(Clamp(#Alpha2#-5,1,255))"]#U#
DynamicVariables=1

[Slice_01]
Meter=Image
Group=Slices
ImageName=#@#slice_01.png
X=0
Y=0
ImageAlpha=#Alpha1#
MouseOverAction=[!SetOptionGroup Slices ImageAlpha 1][!SetOption Slice_01 ImageAlpha "#*Alpha1*#"][!CommandMeasure Fader "Stop 2"][!CommandMeasure Fader "Execute 1"]
MouseLeaveAction=[!SetOptionGroup Slices ImageAlpha 1][!SetOption Slice_01 ImageAlpha "#*Alpha1*#"][!CommandMeasure Fader "Stop 1"][!CommandMeasure Fader "Execute 2"]
DynamicVariables=1

[Slice_02]
Meter=Image
Group=Slices
ImageName=#@#slice_02.png
X=96
Y=0
ImageAlpha=#Alpha2#
MouseOverAction=[!SetOptionGroup Slices ImageAlpha 1][!SetOption Slice_02 ImageAlpha "#*Alpha2*#"][!CommandMeasure Fader "Stop 4"][!CommandMeasure Fader "Execute 3"]
MouseLeaveAction=[!SetOptionGroup Slices ImageAlpha 1][!SetOption Slice_02 ImageAlpha "#*Alpha2*#"][!CommandMeasure Fader "Stop 3"][!CommandMeasure Fader "Execute 4"]
DynamicVariables=1
It should work fine.

GIF.gif
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with fader in ActionTimer!

Post by jsmorley »

BTW, there is really no need for the !SetOption bangs on the mouse over / mouse leave actions. it will work smoother without them:

Code: Select all

[Rainmeter]
Update=1
SkinWidth=1920
SkinHeight=1080

[Variables]
Alpha1=1
Alpha2=1
Wait=8
U=[!UpdateMeasure Fader][!UpdateMeter *][!Redraw]

[Fader]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat FadeIn1,#Wait#,51
FadeIn1=[!SetVariable Alpha1 "(Clamp(#Alpha1#+5,1,255))"]#U#
ActionList2=Repeat FadeOut1,#Wait#,51
FadeOut1=[!SetVariable Alpha1 "(Clamp(#Alpha1#-5,1,255))"]#U#
ActionList3=Repeat FadeIn2,#Wait#,51
FadeIn2=[!SetVariable Alpha2 "(Clamp(#Alpha2#+5,1,255))"]#U#
ActionList4=Repeat FadeOut2,#Wait#,51
FadeOut2=[!SetVariable Alpha2 "(Clamp(#Alpha2#-5,1,255))"]#U#
DynamicVariables=1

[Slice_01]
Meter=Image
Group=Slices
ImageName=#@#slice_01.png
X=0
Y=0
ImageAlpha=#Alpha1#
MouseOverAction=[!CommandMeasure Fader "Stop 2"][!CommandMeasure Fader "Execute 1"]
MouseLeaveAction=[!CommandMeasure Fader "Stop 1"][!CommandMeasure Fader "Execute 2"]
DynamicVariables=1

[Slice_02]
Meter=Image
Group=Slices
ImageName=#@#slice_02.png
X=96
Y=0
ImageAlpha=#Alpha2#
MouseOverAction=[!CommandMeasure Fader "Stop 4"][!CommandMeasure Fader "Execute 3"]
MouseLeaveAction=[!CommandMeasure Fader "Stop 3"][!CommandMeasure Fader "Execute 4"]
DynamicVariables=1
GIF.gif
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with fader in ActionTimer!

Post by balala »

Damn! jsmorley beat me. Again.
jsmorley wrote: December 11th, 2018, 8:23 pm I'm quite sure that what is happening is that those image meters overlay each other. That will completely confuse the "mouse over / mouse leave" stuff, as the mouse will be detected by both image meters.
I think it's not so simple.
andersonventura wrote: December 11th, 2018, 8:01 pm Until now I have been able to make the images fadein on mouseover. however, only works when the mouse comes from outside the skin. when I am inside the skin and I direct the mouse to the next image the effect does not work.
The issue is that you're using one single variable (Alpha), which should have to be used to set the transparency of two meters: [Slice_01] and [Slice_02]. I probably would use two different variables (for example Alpha1 and Alpha2), to set the transparency of meters. for this, besides adding the variables, you also have to add further options to the [Fader] ActiontTimer plugin measure, or even better, to duplicate the measure, to can set the values of the variables independently. What you definitely shouldn't have to do is to directly set the value of a variable (in this case the value of Alpha), through some !SetVariable bangs.
User avatar
andersonventura
Posts: 57
Joined: December 11th, 2018, 7:38 pm
Location: Brasil

Re: Help with fader in ActionTimer!

Post by andersonventura »

jsmorley wrote: December 11th, 2018, 8:57 pm BTW, there is really no need for the !SetOption bangs on the mouse over / mouse leave actions. it will work smoother without them:

Code: Select all

[Rainmeter]
Update=1
SkinWidth=1920
SkinHeight=1080

[Variables]
Alpha1=1
Alpha2=1
Wait=8
U=[!UpdateMeasure Fader][!UpdateMeter *][!Redraw]

[Fader]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat FadeIn1,#Wait#,51
FadeIn1=[!SetVariable Alpha1 "(Clamp(#Alpha1#+5,1,255))"]#U#
ActionList2=Repeat FadeOut1,#Wait#,51
FadeOut1=[!SetVariable Alpha1 "(Clamp(#Alpha1#-5,1,255))"]#U#
ActionList3=Repeat FadeIn2,#Wait#,51
FadeIn2=[!SetVariable Alpha2 "(Clamp(#Alpha2#+5,1,255))"]#U#
ActionList4=Repeat FadeOut2,#Wait#,51
FadeOut2=[!SetVariable Alpha2 "(Clamp(#Alpha2#-5,1,255))"]#U#
DynamicVariables=1

[Slice_01]
Meter=Image
Group=Slices
ImageName=#@#slice_01.png
X=0
Y=0
ImageAlpha=#Alpha1#
MouseOverAction=[!CommandMeasure Fader "Stop 2"][!CommandMeasure Fader "Execute 1"]
MouseLeaveAction=[!CommandMeasure Fader "Stop 1"][!CommandMeasure Fader "Execute 2"]
DynamicVariables=1

[Slice_02]
Meter=Image
Group=Slices
ImageName=#@#slice_02.png
X=96
Y=0
ImageAlpha=#Alpha2#
MouseOverAction=[!CommandMeasure Fader "Stop 4"][!CommandMeasure Fader "Execute 3"]
MouseLeaveAction=[!CommandMeasure Fader "Stop 3"][!CommandMeasure Fader "Execute 4"]
DynamicVariables=1

GIF.gif
You are GOD!!! Thanks!!!!!!!!

Thanks balala for helping too!!

:thumbup:
User avatar
andersonventura
Posts: 57
Joined: December 11th, 2018, 7:38 pm
Location: Brasil

Re: Help with fader in ActionTimer!

Post by andersonventura »

Its done!

Thanks again, guys!

I would just like to add...
With [!redraw] the skin was consuming 26% of processing, and fluidity was very compromised! Removing [!redraw] is running smoothly & faster and consuming only 15% of processing!

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

Re: Help with fader in ActionTimer!

Post by jsmorley »

You need to change Update=1 to Update=1000

There is no need to have the skin trying to update once every millisecond. First, it can't, and second, that will be very CPU expensive.

Put back the [!Redraw]

Remove the

SkinWidth=1920
SkinHeight=1080

There is just no need to have the skin use the entire screen. That is just pointlessly expensive on each redraw. If the intent is to "fix" the position of the skin in a certain spot on the screen, and preclude accidentally moving it, that can be done other, far less expensive ways.

The skin should use pretty much 0% CPU.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with fader in ActionTimer!

Post by jsmorley »

I think where you got the Update=1 from is a misreading of a skin where you saw Update=-1

Update=-1 means "never update automatically again after the very first update", which actually would be good for this skin, since it is entirely "interrupt / event driven" by the mouse.

This line:

U=[!UpdateMeasure Fader][!UpdateMeter *][!Redraw]

Will take care of all the "updating" that is needed, and only as needed.