-
Expression: As Value Increases, Loop from 0 to 100
Is there an expression that can loop from 0 to 100 (or any arbitrary value) as a slider value increases indefinitely? For example, as the slider increases from 0 to 100, the expression outputs 0 to 100. Then when the slider increases from 100 to 200, the expression outputs 0 to 100 again. A slider value of 1328 would output 28, for example, and a slider value of 8568 would result in 68.
I’ve searched around for this type of functionality but haven’t been able to find anything along these lines.
I can make something loop twice using if/else statements, but if I want three repetitions (or four, etc.), I’d have to enter new variables and another tree to the if/else statement for each repetition I’d want. Heres is an expression repeating twice:
input=thisComp.layer("Null 2").effect("Slider Control")("Slider");
il1=0;
ih1=50;
ol1=116.5;
oh1=-1883.4;
il2=50;
ih2=100;
ol2=116.5;
oh2=-1883.4;
if(input<50){
linear(input,il1,ih1,ol1,oh1);
}else{
linear(input,il2,ih2,ol2,oh2);
}I’m attempting to make an odometer style counter and have the digits from 0-9 vertically in a text layer. I’m adjusting the vertical position of these layers as the slider increases. I’m using the linear function above to remap the slider to the relevant vertical positions I need for the text layers. Unfortunately, this doesn’t scale to X number of repetitions, only 2.
Is there a way to loop a set of values as a slider value indefinitely increases?
Thank you for reading!