Fix Loop Bug in After Effects

Recently I discovered a nasty bug when looping time remap. I’ll try to explain it on the screenshot below.

 

The result is we lost 2 frames of animations. When precision matters, it sucks.

The main point is if you think there is something wrong with your time remap loop try the expression below instead of default loopOut.

// start - first keyframe
timeStart = thisProperty.key(1).time; 
// count duration
duration = thisProperty.key(thisProperty.numKeys).time + thisComp.frameDuration - timeStart ; 
// cycle number
quant = Math.floor((time - timeStart) / duration); 
if (quant < 0) quant = 0 // != 0
if (((time - timeStart) / duration).toString() == Math.floor((time + thisComp.frameDuration - timeStart) / duration)) {
  t = timeStart;
} else {
  t = time - quant * duration;  
}


thisProperty.valueAtTime(t);

You can also change the variable pingPong to true if you need a pingpong animation instead.

I spent 2 days only figuring out what was the problem, hope it helps someone.

Let me know in the comments if it did the trick for you.

 

Get 5% off when you sign up

By subscribing you agree to your email being stored and used to receive the emails in accordance to our Privacy Policy
descount