Copy link to clipboard
Copied
I want to write an expression in after effects which allows to have incremental number variable...
This is what I wanna do, Let me explain my need.
I've applied a slider to a text layer. And I wrote the following expression to sourceText property of the text layer
i = 0;
slider = Math.round(effect("Slider Control")("Slider"));
if (!(slider/4 % 1)){
i++;
}else{
slider+i;
}
I want to know how can I make that i++ affect i value in the first line. If the slider value is divisible by 4 which are 4,8,12,16 and so on.. the i should Increase it's value from 0 to 1. Means when the slider cross the value 4 the value of i should change to 1 So when the slider value is 5 now the print value will be slider+i which is (5+1) six 6. and when the slider cross the value 8. the value of i should be 2. and this should happens inside the expression. I know I've assigned i=0; so this expression won't work. I want to achieve the thing I've asked. How can I write the expression to achieve it?????
Wouldn't this work?
slider = Math.round(effect("Slider Control")("Slider"));
i = Math.floor(slider/4);
slider+i
Dan
Copy link to clipboard
Copied
A simple for() loop will do.
Mylenium
Copy link to clipboard
Copied
No. In expression editor for() loop only returns the value from last loop. I won't care about other values.
Copy link to clipboard
Copied
Wouldn't this work?
slider = Math.round(effect("Slider Control")("Slider"));
i = Math.floor(slider/4);
slider+i
Dan
Copy link to clipboard
Copied
It worked... Thanks.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more