Action Timer used in string meter?

Help with creating, editing & fixing problems with skins

Action Timer used in string meter?

February 15th, 2017, 2:01 pm
TrueFaith
   [19 posts]

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

Re: Action Timer used in string meter?

February 15th, 2017, 2:40 pm
jsmorley
Developer   [15407 posts]

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

Re: Action Timer used in string meter?

February 15th, 2017, 2:57 pm
jsmorley
Developer   [15407 posts]

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

Re: Action Timer used in string meter?

February 15th, 2017, 6:03 pm
TrueFaith
   [19 posts]

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

Re: Action Timer used in string meter?

February 15th, 2017, 6:23 pm
jsmorley
Developer   [15407 posts]

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

Re: Action Timer used in string meter?

February 16th, 2017, 2:03 pm
jsmorley
Developer   [15407 posts]

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.

Re: Action Timer used in string meter?

February 16th, 2017, 3:58 pm
TrueFaith
   [19 posts]

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

Re: Action Timer used in string meter?

February 16th, 2017, 4:02 pm
jsmorley
Developer   [15407 posts]

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.

Return to “Help: Rainmeter Skins”



Who is online

Users browsing this forum: Google [Bot] and 1 guest