-
Loop animation via expression.
Hi everybody!
I`m trying to link playback of one object`s animation cycle to movement of another one. I use Duik morpher to link all keyframes to one slider and link this slider to x-position of null object. The point is to make it work in cycle. I actually done it (may be in a little weird way). See the code below.Here 15 is a length of animation cycle. It works, but have one issue – when position goes lower zero the loop stops playing. I understand why it behave this way, but don`t know how to fix it.
P.S. sorry for cyrillic letters in the code, unfortunately I have russian version of AE. Пусто 1 equals Null 1.if ((thisComp.layer("Пусто 1").transform.xPosition) <15) (thisComp.layer("Пусто 1").transform.xPosition) else (thisComp.layer("Пусто 1").transform.xPosition)-(Math.round((thisComp.layer("Пусто 1").transform.xPosition)/15-0.5))*15