Expression Copied to Clipboard! πŸ—‚
← Back to Expressions

Loop Path Keyframes - After Effects Expression

Seamlessly loop keyframes on a Path Property for shape layers or masks.

Loop Path Keyframes

// loop path keyframes. Behaves like loopOut('cycle')
if (numKeys >1 && time > key(numKeys).time) {
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
t = delta%span;
valueAtTime(t1 + t)
} else {
value
}

‍

Copied to Clipboard!
// loop path keyframes. Behaves like loopOut('cycle')
if (numKeys >1 && time > key(numKeys).time) { t1 = key(1).time; t2 = key(numKeys).time; span = t2 - t1; delta = time - t2; t = delta%span; valueAtTime(t1 + t)
} else { value
}
// more expressions at aereference.com

How to Use

Apply the above expression to the path property on a shape layer or mask to loop your keyframes like a normal loopOut("cycle")


About

Many tasks in animation can benefit from looping (repeating the same thing over and over). In many cases, you can apply one of After Effect's default looping expressions loopOut("cycle") expression. (Or the improved loop in and out expression)


Unfortunately, those don't work on animated Paths.


This expression allows you to loop keyframes on an animated path - handy for creating custom animations on shape layers or masks without having to copy/paste a lot.

‍

More expressions you might like...

Credit

Courtesy of the master expressionisto Dan Ebberts.