Cat’s tail on the preview is an animated path and I’ll show you how to loop it.

**How to loop a path in After Effects?**

Alt-click on the **Path** property and paste an expression below.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | // if you don't need pingpong - false pingPong = false; try{ // start - first keyframe timeStart = thisProperty.key(1).time; // count duration duration = thisProperty.key(thisProperty.numKeys).time - timeStart; // cycle number quant = Math.floor((time - timeStart) / duration); if (quant < 0) quant = 0 // != 0 if (quant % 2 == 1 && pingPong == true){ t = 2 * timeStart + (quant+1) * duration - time; } else { t = time-quant*duration; } } catch(e) { t = time; } thisProperty.valueAtTime(t); |

This expression works in the same way as a standard loop cycle expression below.

1 | loopOut(type="cycle"); |

**How to loop a path like “pingpong”?**

Alt-click on the **Path** property and paste an expression below.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | // if you don't need pingpong - false pingPong = true; try{ // start - first keyframe timeStart = thisProperty.key(1).time; // count duration duration = thisProperty.key(thisProperty.numKeys).time - timeStart; // cycle number quant = Math.floor((time - timeStart) / duration); if (quant < 0) quant = 0 // !=0 if (quant % 2 == 1 && pingPong == true) { t = 2 * timeStart + (quant + 1) * duration - time; } else { t = time - quant * duration; } } catch(e) { t = time; } thisProperty.valueAtTime(t); |

This expression works in the same way as a standard loop “**pingpong**” expression below.

1 | loopOut(type="pingpong"); |