LuciferVisuals wrote: ↑April 28th, 2023, 9:25 pmI tried to use one set with a negative calc but that was not working at all, so I simplified the problem into two different animations [...] And I cannot see why it only works once.
I'll let balala answer the specific question(s) if needed, I'm just going to point out the obvious: both the Loop measures and the Calc ones can be made to "ping pong" back and forth between values. The Calcs, as you guessed, do this via alternating between positive and negative incrementation (not sure why you didn't succeed with that one, cause it should have worked), and the Loops do this via alternating the value of the
InvertMeasure option. Both of these are either alluded to or explicitly stated in the manual, especially in the case of
Loops - check the 2nd example on that page, it's almost what you need.
What this means is that you don't necessarily need 2 sets of images, 2 Loops, etc. One is enough:
Code: Select all
[Rainmeter]
Update=500
DynamicWindowSize=1
AccurateText=1
[Variables]
Start=0
End=10
Step=1
Invert=0
---Measures---
[Loop]
Paused=1
Measure=Loop
StartValue=#Start#
EndValue=#End#
Increment=#Step#
LoopCount=1
InvertMeasure=#Invert#
;OnUpdateAction=[!SetVariable Invert ([#CURRENTSECTION#]=0+1?0:([#CURRENTSECTION#]=10-1?1:#Invert#))]
DynamicVariables=1
---Meters---
[Increment]
Meter=String
X=0
SolidColor=255,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=Increment
LeftMouseUpAction=[!PauseMeasure Loop][!SetVariable Invert 0][!UnpauseMeasure Loop]
[Value]
Meter=String
X=120
W=60
SolidColor=0,255,0,255
Padding=5,5,5,5
AntiAlias=1
StringAlign=Center
MeasureName=Loop
[Decrement]
Meter=String
X=170
SolidColor=0,0,255,255
Padding=5,5,5,5
AntiAlias=1
Text=Decrement
LeftMouseUpAction=[!PauseMeasure Loop][!SetVariable Invert 1][!UnpauseMeasure Loop]
LoopIncDec.jpg
This does what you need when it comes to measures, I'm guessing adapting / adjusting stuff for your buttons / other meters / scenario won't be a problem by now, if you prefer to do it this way. If you change the direction in the middle of the iteration, it will start from one of the interval bounds instead of continuing from where you were (like a Calc would do, for example), because this is how Loops behave (and one of the reasons they're not used so much otherwise).
P.S. I let the commented OnUpdateAction there because, along with the Invert variable, it's the shorter version what [MeasurePingPong] from the manual does, when it comes to a continuously updated measure (i.e. not paused or disabled). The +1 and -1 in the related conditional can be modified to +0 and -0 if staying for one more update on the interval bounds is desired. Naturally, since it's commented, you probably won't need it so it can be removed - it's there for reference, since in your case the pausing, measure inversion and unpausing do the same in the mouse actions.
P.S.S. Oh, and can you enclose the code you post between code tags like illustrated below? It would be much easier to follow that way:
Code.jpg
You do not have the required permissions to view the files attached to this post.