severedmars wrote: ↑July 17th, 2021, 6:40 pm
I am working on a clock display that uses a bar to measure minutes. I currently have the bar working, but I want an animation to play before it resets to the empty bar again. How would I make that work?
First you need an ActionTimer plugin measure, add the following one to your code:
Code: Select all
[MeasureReset]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Reset,20,10
Reset=[!SetVariable Step "(Clamp((#Step#+1),0,10))"]#U#
IfCondition=(#Step#=10)
IfTrueAction=[!SetVariable Step "0"]#U#
DynamicVariables=1
As you can see this measure uses two variables, U and Step. Add them to the [Variables] section:
Code: Select all
[Variables]
Step=0
U=[!UpdateMeasure "MeasureReset"][!UpdateMeasure "Calculate"][!UpdateMeter "MeterProgressBar"][!Redraw]
Modify the [Calculate] measure as it follows:
Code: Select all
[Calculate]
Measure=Calc
Formula=(( MeasureTime > 0 ) ? MeasureTime : (( #Step# > 0 ) ? ( 60 - 60 * #Step# / 10 ) : 0 ))
MaxValue=59
DynamicVariables=1
And finally as SilverAzide said, you need to add a condition to the [MeasureTime] to execute the previously added [MeasureReset] ActionTimer plugin measure. Add the following condition:
Code: Select all
[MeasureTime]
Measure=Time
Format=%M
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!CommandMeasure "MeasureReset" "Execute 1"]
With all this your code will look this way:
Code: Select all
[Rainmeter]
Update=1000
[Variables]
Step=0
U=[!UpdateMeasure "MeasureReset"][!UpdateMeasure "Calculate"][!UpdateMeter "MeterProgressBar"][!Redraw]
[MeasureReset]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Reset,20,10
Reset=[!SetVariable Step "(Clamp((#Step#+1),0,10))"]#U#
IfCondition=(#Step#=10)
IfTrueAction=[!SetVariable Step "0"]#U#
DynamicVariables=1
[MeasureTime]
Measure=Time
Format=%M
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!CommandMeasure "MeasureReset" "Execute 1"]
[Calculate]
Measure=Calc
Formula=(( MeasureTime > 0 ) ? MeasureTime : (( #Step# > 0 ) ? ( 60 - 60 * #Step# / 10 ) : 0 ))
MaxValue=59
DynamicVariables=1
[MeterProgressBar]
Meter=BAR
MeasureName=Calculate
X=13
Y=21
BarImage=#@#Images\minutebar.png
BarOrientation=Vertical
Please let me know if this is what you want.