Copy link to clipboard
Copied
Hey, I'm making an animation bank.
As it is a bank and I will use it for various projects, I want the assets to be as editable as possible.
Each assets consists three comps - start, body (loop), and ending, so I could alter the length of the asset as I please.
the body comp is a single, cycle type, loop, which the loop expression is configured on its Time Remap value.
I know that you can limit the cycles based on a timestamp, but is there an expression that makes the loop go only in full cycles depends on the layer length?
for example: a layer is 5:00 sec in length, the looped keyframes are 2:00 sec in total.
In that scenario the loop will have 2.5 cycles, but I want the expression to recgonize that after 2 loops it won't be able to complete a third cycle so it will freeze on the last frame
for clarifications I use LoopOut exxpression on all of those said layers.
Thank you!
Thank you so much Dan!
I have changed (thisComp.duration - key(1).time) to (thisLayer.outPoint - thisLayer.inPoint) so the loop will end based on the layer duration and not the whole comp which is located in.
So the full expression is:
loopDur = key(numKeys).time - key(1).time;
numLoops = Math.floor((thisLayer.outPoint - thisLayer.inPoint)/loopDur);
if (time < key(1).time + numLoops*loopDur)
loopOut()
else
key(numKeys).value;
Thank you so much!
Copy link to clipboard
Copied
Not with this method. You would have to use valueAtTime() and write your own loop code.
Mylenium
Copy link to clipboard
Copied
Try this time remapping expression:
loopDur = key(numKeys).time - key(1).time;
numLoops = Math.floor((thisComp.duration - key(1).time)/loopDur);
if (time < key(1).time + numLoops*loopDur)
loopOut()
else
key(numKeys).value;
Copy link to clipboard
Copied
Thank you so much Dan!
I have changed (thisComp.duration - key(1).time) to (thisLayer.outPoint - thisLayer.inPoint) so the loop will end based on the layer duration and not the whole comp which is located in.
So the full expression is:
loopDur = key(numKeys).time - key(1).time;
numLoops = Math.floor((thisLayer.outPoint - thisLayer.inPoint)/loopDur);
if (time < key(1).time + numLoops*loopDur)
loopOut()
else
key(numKeys).value;
Thank you so much!