How to make time varying for loop expression that changes value for every sec..
Copy link to clipboard
Copied
example. I've made this expression inside Source Text Property.
for (t = Math.round(time); t<10 ; t++){
t
}
When I click away. This loop runs through and shows only last value that is 9. But all I want is limit this loop based on time. So if I change this expression to
for (t = Math.round(time); t<10 ; time){
t
}
After effects goes unresponding. So how can I use these type of loops in after effects.
Copy link to clipboard
Copied
In AE, a for-loop iterates on the current frame, until it's condition isn't true anmore. Both of your examples are a wrong use of for.
Usual, for a for-loop you have a new iterate-variable and if you want to control the loop over time, you switch it on and off with an if-condition.
if (Math.floor(time) < 10){
for (i = 0; i < 5; i ++){
... some code ...
};
};
For a better help, please tell as in more detail, what you want to achive.
Copy link to clipboard
Copied
Loops can also be controlled with break and continue. But Martin is right - your syntax makes very little or no sense to begin with. You've just writtne a bit of useless code that will always return the last value in the loop, no matter what condition.
Mylenium

