Copy link to clipboard
Copied
Hi, i am trying to create an expression, that counts the number of iterations, a formula needs to reach a given value, and am wondering if this is even possible in AE, since i could not find anything like this online... I tried the following:
var t=1;
var i=0;
if (t<5) {t+1, i+1};
;
I would like i to return 4 in this case, but it always returns 0. Any Suggestions?
Thanks a lot,
Expressions have no memory, so incrementing a variable for the next frame won't work. Depending on what you're trying to do, you can usually do the necessary calculations using time, the current comp time.
Dan
Copy link to clipboard
Copied
Expressions have no memory, so incrementing a variable for the next frame won't work. Depending on what you're trying to do, you can usually do the necessary calculations using time, the current comp time.
Dan
Copy link to clipboard
Copied
Thanks, dan, that was what i feared. Maybe i will get it to work using time... do you know by any chance, whats the smallest increment of time i can use? is it a Frame? or is it smaller? Thanks for your help...
Copy link to clipboard
Copied
time represents seconds since the start of the comp. You can use any fractional value you want. The duration of a single frame is available with thisComp.frameDuration.
Dan
Copy link to clipboard
Copied
Thanks again! I think i was sloppy, describing my initial problem, i just got it to work using the following code:
i=0;
t=1;
while(t < 5){
i++, t=t+2;
}
Have a nice evening:)