Bub wrote:The idea was when rig goes to state mode (PLUGGED and FULLY CHARGED) and skin switches to MeterBatteryBar3 (thanks to you!
) this Bar3 start fading in and out.
For a such action we should have to use the (very good!) ActionTimer plugin. I added the needed sections / option, see the code below:
Code: Select all
[Rainmeter]
Update=100
DefaultUpdateDivider=10
[Variables]
@include=#@#Options.inc
Alpha=0
U=[!UpdateMeasure "MeasureSlide"][!UpdateMeasure "MeasureAlpha"][!UpdateMeter "MeterBatteryBar3"][!Redraw]
Wait=50
[StringStyle]
StringAlign=left
FontColor=#FontColor#
FontSize=#FontHeight1#
FontFace=#Font#
AntiAlias=1
Text=%1
[BarStyle]
MeasureName=MeasurePercent
X=56
Y=4
W=220
H=10
SolidColor=#graph.line2#
BarOrientation=Horizontal
[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat FadeIn,#Wait#,20
FadeIn=[!SetVariable Alpha "(Clamp((#Alpha#+1),0,20))"]#U#
ActionList2=Repeat FadeOut,#Wait#,20
FadeOut=[!SetVariable Alpha "(Clamp((#Alpha#-1),0,20))"]#U#
DynamicVariables=1
[MeasureAlpha]
Measure=Calc
Formula=#Alpha#
IfCondition=(#Alpha#=20)
IfTrueAction=[!CommandMeasure "MeasureSlide" "Stop 1"][!CommandMeasure "MeasureSlide" "Execute 2"]
IfCondition2=(#Alpha#=0)
IfTrueAction2=[!CommandMeasure "MeasureSlide" "Stop 2"][!CommandMeasure "MeasureSlide" "Execute 1"]
DynamicVariables=1
Disabled=1
[MeasurePercent]
Measure=Plugin
PlugIn=PowerPlugin
PowerState=PERCENT
[MeasureStatus]
Measure=Plugin
PlugIn=PowerPlugin
PowerState=STATUS
Substitute="0":"NO BATTERY","1":"Charging","2":"CRITICAL","3":"Low","4":"Above Low"
[MeasureACLine]
Measure=Plugin
PlugIn=PowerPlugin
PowerState=ACLINE
Substitute="0":"BATTERY","1":"PLUGGED"
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeterStatusLifetime MeasureName "MeasureLifetime"][!UpdateMeter "MeterStatusLifetime"][!Redraw]
IfFalseAction=[!SetOption MeterStatusLifetime MeasureName "MeasureStatus"][!UpdateMeter "MeterStatusLifetime"][!Redraw]
[MeasureStat]
Measure=Calc
Formula=(( MeasureStatus = 0 ) ? -1 : ( MeasureACLine * MeasurePercent ))
IfCondition=(#CURRENTSECTION#<0)
IfTrueAction=[!HideMeter "MeterBatteryBar1"][!HideMeter "MeterBatteryBar2"][!HideMeter "MeterBatteryBar3"][!SetVariable Alpha "0"][!DisableMeasure "MeasureAlpha"]#U#
IfCondition2=(#CURRENTSECTION#=0)
IfTrueAction2=[!HideMeter "MeterBatteryBar1"][!ShowMeter "MeterBatteryBar2"][!HideMeter "MeterBatteryBar3"][!SetVariable Alpha "0"][!DisableMeasure "MeasureAlpha"]#U#
IfCondition3=((#CURRENTSECTION#>0)&&(#CURRENTSECTION#<100))
IfTrueAction3=[!ShowMeter "MeterBatteryBar1"][!HideMeter "MeterBatteryBar2"][!HideMeter "MeterBatteryBar3"][!SetVariable Alpha "0"][!DisableMeasure "MeasureAlpha"]#U#
IfCondition4=(#CURRENTSECTION#=100)
IfTrueAction4=[!HideMeter "MeterBatteryBar1"][!HideMeter "MeterBatteryBar2"][!ShowMeter "MeterBatteryBar3"][!EnableMeasure "MeasureAlpha"]
[MeasureLifetime]
Measure=Plugin
PlugIn=PowerPlugin
PowerState=LIFETIME
Format=%#Hh %Mm
[ImageNumberCalc]
Measure=Calc
Formula=( Counter % 4 )
UpdateDivider=1
;=============================================
;Background
;=============================================
[Meter.Background]
Meter=Image
X=0
Y=0
H=28
W=276
SolidColor=#Background.color#
[MeterBattery]
MeasureName=MeasureACLine
Meter=STRING
MeterStyle=StringStyle
FontColor=#FontColor#
FontSize=#FontHeight2#
FontFace=#Font#
X=51
Y=10
StringAlign=RightCenter
;=============================================
;Graphs
;=============================================
[MeterBatteryBar1]
Meter=Bar
MeterStyle=BarStyle
MeasureName=MeasurePercent
BarImage=Frames\bar2_[ImageNumberCalc].png
DynamicVariables=1
UpdateDivider=1
[MeterBatteryBar2]
Meter=Bar
MeterStyle=BarStyle
MeasureName=MeasurePercent
BarColor=#graph.line1#
[MeterBatteryBar3]
Meter=Bar
MeterStyle=BarStyle
MeasureName=MeasurePercent
BarColor=255,240,0,(12.75*#Alpha#)
DynamicVariables=1
[MeterStatusLifetime]
Meter=STRING
MeterStyle=StringStyle
X=6r
Y=14r
StringAlign=Left
[MeterPercent]
MeasureName=MeasurePercent
Meter=STRING
MeterStyle=StringStyle
X=212r
Y=0r
StringAlign=Right
Postfix=%
The fading of the [MeterBatteryBar3] meter is done through a newly added Alpha variable. Its values varies between 0 (in this case the bar isn't visible) and 20 (the bar is fully opaque). The value of this variable is controlled by the newly added [MeasureSlide] measure. This is the ActionTimer plugin measure. Another new measure is [MeasureAlpha], which once the fading started, will turn back the value of the Alpha variable when this one reaches it lowest / largest possible value. When this plugin is started / stopped, is controlled by the [MeasureAlpha] measure, which is enabled / disabled by the appropriate bangs of the IfTrueAction options of the [MeasureStat] measure.
The speed of the fade effect, is set through the new Wait variable ([Variables] section). Take into account that the higher the variable is, the slower the effect will occur.
Please test this code and let me know if it has problems.