-
Loop AE expression?
Hi, I’m trying to loop the z-position of a 3D layer using only expression, I need it to work without using keyframes or time remapping, but I’m running in to a strange problem.
This is the code I’m testing with,
This loops one time (code1):
var_zpos = time*2000;
if (var_zpos > 5000){var_zpos = var_zpos-5000};[640, 360, var_zpos];
And If I do this it loops 7 times (code2):
(this is the result I want but forever looping)
var_zpos = time*2000;
if (var_zpos > 5000){var_zpos = var_zpos-5000};
if (var_zpos > 5000){var_zpos = var_zpos-5000};
if (var_zpos > 5000){var_zpos = var_zpos-5000};
if (var_zpos > 5000){var_zpos = var_zpos-5000};
if (var_zpos > 5000){var_zpos = var_zpos-5000};
if (var_zpos > 5000){var_zpos = var_zpos-5000};
if (var_zpos > 5000){var_zpos = var_zpos-5000};[640, 360, var_zpos];
unexpected result. (code3):
var_zpos = time*2000;
if (var_zpos > 5000){var_zpos = var_zpos-5000};
if (var_zpos > 10000){var_zpos = var_zpos-10000};
if (var_zpos > 15000){var_zpos = var_zpos-15000};
if (var_zpos > 20000){var_zpos = var_zpos-20000};
if (var_zpos > 25000){var_zpos = var_zpos-25000};
if (var_zpos > 30000){var_zpos = var_zpos-30000};
if (var_zpos > 35000){var_zpos = var_zpos-35000};[640, 360, var_zpos];
To me this don’t makes sense, that the “if statement” only runs once then I have to paste another one. I understand why this first code would not work, and It behaves as I would expect, when time*2000 is 10000 it will be 10000-5000 and It will just continue past the 5000 position, but then I would expect this (code 3) to behave like (code2)currently does:
simple test comp download(CS6):
https://patan77.com/download/ae_loop_z_test.aepthanks.