Forums › Adobe After Effects Expressions › Using loop expressions in conjunction with other expressions
-
Using loop expressions in conjunction with other expressions
-
Seymour Frost
May 17, 2022 at 3:11 pmHello! Is there any way to use a loop expression on a property that already has an expression on it? The problem I came across was in building a simple rig that used an expression on the scale property to maintain the volume of an object. But then, when I went to put an loopOut() expression on this property, it would not loop.
on scale:
var x = value[0];
var xFactor = (100 – x);
var y = 100 + xFactor;
[x, y];
and then to loop the set of keyframes I made, regardless of whether I needed to move the keyframes in the comp:
loopIn() + loopOut() – value;
I’ve tried redefining the value as the returned array from the first part of the code, but that didn’t work. I thought that the loop expressions simply read the value of the keyframes that were set, and thus wouldn’t be impacted by any expressions making calculations on every frame. Am I just fundamentally misunderstanding something?
Thanks!
-
Dan Ebberts
May 17, 2022 at 4:18 pmI think you just need to stick the result of your loop calculation into a variable and use that instead of value in the other part of your expression, like this:
val = loopIn() + loopOut() - value;
x = val[0];
xFactor = (100 - x);
y = 100 + xFactor;
[x, y];
-
Seymour Frost
May 17, 2022 at 5:05 pmThanks so much, Dan! That, of course, worked brilliantly.
Log in to reply.