It is currently March 28th, 2024, 11:25 pm

Action Timer used in string meter?

Get help with creating, editing & fixing problems with skins
TrueFaith
Posts: 19
Joined: November 28th, 2016, 7:28 am

Action Timer used in string meter?

Post by TrueFaith »

i was looking for some transition effects, and found 2 solutions - kaelri lua script without enabled groups of metes aaand action timer from tips & tricks.

i did choose action timer, since there was in depth guide. but i found some issue with using my #Alpha# variable at string meters. i want to make fade in/fade out effect on text.

so the code is smth like this

Code: Select all

[Variables]
Alpha=0
U=[!UpdateMeasure MeasureSlider][!UpdateMeter *][!Redraw]


[Fading]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat FadeIn,16,40
FadeIn=[!SetVariable Alpha "(Clamp(#Alpha#-10,0,255))"][!UpdateMeasure Fading]#U#
ActionList2=Repeat FadeOut,16,40
FadeOut=[!SetVariable Alpha "(Clamp(#Alpha#+10,0,255))"][!UpdateMeasure Fading]#U#
DynamicVariables=1
IgnoreWarnings=1
IfCondition=(#Alpha#<1)
IfTrueAction=[!HideMeterGroup Nya]
IfCondition2=(#Alpha#>1)
IfTrueAction2=[!ShowMeterGroup Nya]

[Meter]
Meter=String
MeterStyle=Text
W=69
H=57
X=20
Y=32
DynamicVariables=1
FontColor=255,255,255,#Alpha#
Hidden=1
Group=Nya
i used #Alpha# variable in FontColor, im not sure is it correst to set transparency for text.

the problem is that transition goes wrong during fade out. it goes from white to black, and then triggers ifCondition at then when Alpha is below 1.

i cant figure why it goes from white to black instead of going from white to trasparent. what im doing wrong?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer used in string meter?

Post by jsmorley »

TrueFaith wrote:i was looking for some transition effects, and found 2 solutions - kaelri lua script without enabled groups of metes aaand action timer from tips & tricks.

i did choose action timer, since there was in depth guide. but i found some issue with using my #Alpha# variable at string meters. i want to make fade in/fade out effect on text.

so the code is smth like this

Code: Select all

[Variables]
Alpha=0
U=[!UpdateMeasure MeasureSlider][!UpdateMeter *][!Redraw]


[Fading]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat FadeIn,16,40
FadeIn=[!SetVariable Alpha "(Clamp(#Alpha#-10,0,255))"][!UpdateMeasure Fading]#U#
ActionList2=Repeat FadeOut,16,40
FadeOut=[!SetVariable Alpha "(Clamp(#Alpha#+10,0,255))"][!UpdateMeasure Fading]#U#
DynamicVariables=1
IgnoreWarnings=1
IfCondition=(#Alpha#<1)
IfTrueAction=[!HideMeterGroup Nya]
IfCondition2=(#Alpha#>1)
IfTrueAction2=[!ShowMeterGroup Nya]

[Meter]
Meter=String
MeterStyle=Text
W=69
H=57
X=20
Y=32
DynamicVariables=1
FontColor=255,255,255,#Alpha#
Hidden=1
Group=Nya
i used #Alpha# variable in FontColor, im not sure is it correst to set transparency for text.

the problem is that transition goes wrong during fade out. it goes from white to black, and then triggers ifCondition at then when Alpha is below 1.

i cant figure why it goes from white to black instead of going from white to trasparent. what im doing wrong?
I don't have all your code, so I can't see how you are triggering the ActionTimer measure, but I will point out that in the variable #U# you are updating a measure that doesn't exist, [MeasureSlider].

Second, at least in this example I'm not sure I see the point in "hiding" a meter that has an opacity of zero. It's pretty much hidden already isn't it... There CAN be a point, but it would involve "relative positioning" of other meters relative to the one you are fading. A "hidden" meter has no width or height, where a "transparent" meter does.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer used in string meter?

Post by jsmorley »

You also have FadeIn and FadeOut reversed, so FadeIn is subtracting alpha, and FadeOut is adding alpha. That's not what you want, or at least it's confusing... Also no need to update the ActionTimer measure twice, just let #U# do the work.

Also, not a big deal really, but you are "repeating" the fade actions 40 times, increasing and decreasing #Alpha# by 10 each time. That is a total change of 400, which you don't really need on a value that is between 0 and 255. Repeating 26 times will get you there, (Really 25.5, but it must be an integer) without wasting any cycles.

Take a look at this example, which does what I think you intend.

Code: Select all

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

[Variables]
Alpha=0
U=[!UpdateMeasure MeasureFade][!UpdateMeter *][!Redraw]

[MeasureFade]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat FadeIn,16,26
FadeIn=[!SetVariable Alpha "(Clamp(#Alpha#+10,0,255))"]#U#
ActionList2=Repeat FadeOut,16,26
FadeOut=[!SetVariable Alpha "(Clamp(#Alpha#-10,0,255))"]#U#
DynamicVariables=1
IgnoreWarnings=1

[MeterFade]
Meter=String
FontSize=30
FontColor=255,255,255,#Alpha#
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
Text=Hello World

[MeterIn]
Meter=String
Y=10R
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Fade In
LeftMouseUpAction=[!CommandMeasure MeasureFade "Stop 2"][!CommandMeasure MeasureFade "Execute 1"]

[MeterOut]
Meter=String
X=10R
Y=0r
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Fade Out
LeftMouseUpAction=[!CommandMeasure MeasureFade "Stop 1"][!CommandMeasure MeasureFade "Execute 2"]
GIF.gif
You do not have the required permissions to view the files attached to this post.
TrueFaith
Posts: 19
Joined: November 28th, 2016, 7:28 am

Re: Action Timer used in string meter?

Post by TrueFaith »

i was using hidemeter to be sure that i can click through, when this meter is hidden.

im just making a skin which will overlay game. and i was struggle with using actiontimer to make some meter slide and fade in\out text.

im looking for your example skin, right now. thank you for tip about repeating 40 times, after i fixed it like you said, transition goes more smooth at last steps. this was very useful!

i fixed this reversed actions just right after i posted code here, only noticed while was copying code to here :D

added:

deleted all my meterstyles to look how text will interact only with FontColor options used in targeted meter. now i realize that text was turned to black during fade out action, cause StringEffect=Shadow.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer used in string meter?

Post by jsmorley »

TrueFaith wrote:i was using hidemeter to be sure that i can click through, when this meter is hidden.

im just making a skin which will overlay game. and i was struggle with using actiontimer to make some meter slide and fade in\out text.

im looking for your example skin, right now. thank you for tip about repeating 40 times, after i fixed it like you said, transition goes more smooth at last steps. this was very useful!

i fixed this reversed actions just right after i posted code here, only noticed while was copying code to here :D

added:

deleted all my meterstyles to look how text will interact only with FontColor options used in targeted meter. now i realize that text was turned to black during fade out action, cause StringEffect=Shadow.
Great. Just FYI, if you have an alpha of "0" (fully transparent) that won't react to the mouse.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer used in string meter?

Post by jsmorley »

BTW, you can use a shadow effect with this, but DON'T use StringEffect=Shadow. In fact, NEVER use StringEffect=Shadow, it's complete crap.

https://docs.rainmeter.net/manual/meters/string/inline/#InlineShadow

Code: Select all

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

[Variables]
Alpha=0
U=[!UpdateMeasure MeasureFade][!UpdateMeter *][!Redraw]

[MeasureFade]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat FadeIn,16,26
FadeIn=[!SetVariable Alpha "(Clamp(#Alpha#+10,0,255))"]#U#
ActionList2=Repeat FadeOut,16,26
FadeOut=[!SetVariable Alpha "(Clamp(#Alpha#-10,0,255))"]#U#
DynamicVariables=1
IgnoreWarnings=1

[MeterFade]
Meter=String
FontSize=30
FontColor=255,255,255,#Alpha#
InlineSetting=Shadow | 2 | 2 | 1 | 50,50,50,200
Padding=0,0,5,0
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
Text=Hello World

[MeterIn]
Meter=String
Y=10R
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Fade In
LeftMouseUpAction=[!CommandMeasure MeasureFade "Stop 2"][!CommandMeasure MeasureFade "Execute 1"]

[MeterOut]
Meter=String
X=10R
Y=0r
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Fade Out
LeftMouseUpAction=[!CommandMeasure MeasureFade "Stop 1"][!CommandMeasure MeasureFade "Execute 2"]
1.jpg
The InlineSetting variant of Shadow is related to the transparency of the overall font color, so it will fade with the string properly. StringEffect=Shadow is just embarrassingly bad. It just creates an unrelated copy of the string, and moves it down and to the right a few pixels. InlineSetting=Shadow | ... is a proper text shadow effect.
You do not have the required permissions to view the files attached to this post.
TrueFaith
Posts: 19
Joined: November 28th, 2016, 7:28 am

Re: Action Timer used in string meter?

Post by TrueFaith »

thank you, with this way it works, but seems its slows action timer animation, at least it did for my group of meters, seems it resourceful?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer used in string meter?

Post by jsmorley »

TrueFaith wrote:thank you, with this way it works, but seems its slows action timer animation, at least it did for my group of meters, seems it resourceful?
Actually yeah, InlineSetting=Shadow does use a bit of CPU, you might want to adjust the speed of your transition to compensate.