Skip to main content
S_ A
Inspiring
Feb 13, 2026 1:15 PM UTC
Answered

how to write expression in such case -18 (trim path looping exactly at every 2 second)

Hi,


I want the whole Trim Path animation to loop in a fixed repetition. I want the entire animation (the way I set the keyframes) to finish and then repeat from start to end at every 2 second.
How can I do this with an expression?
I tried everything, but I can’t achieve what I want. Please help.

 

 

 

 

 

Dan Ebberts
Dan EbbertsCorrect answer
Community Expert
Feb 13, 2026 2:43 PM UTC

Without knowing the names of the properties with the keyframes, you could hard-code the start and end times like this:

tStart = 2;
tEnd = 4;

t = time;
if (time > tEnd){
t = tStart + (time - tEnd)%(tEnd-tStart);
}
valueAtTime(t)

Here’s a stab at what it might look like with the property names:

tStart = content("Shape 1").content("Trim Paths 1").end.key(1).time;
tEnd = content("Shape 2").content("Trim Paths 1").end.key(2).time;

t = time;
if (time > tEnd){
t = tStart + (time - tEnd)%(tEnd-tStart);
}
valueAtTime(t)

 

 

2 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
Feb 13, 2026 2:43 PM UTC

Without knowing the names of the properties with the keyframes, you could hard-code the start and end times like this:

tStart = 2;
tEnd = 4;

t = time;
if (time > tEnd){
t = tStart + (time - tEnd)%(tEnd-tStart);
}
valueAtTime(t)

Here’s a stab at what it might look like with the property names:

tStart = content("Shape 1").content("Trim Paths 1").end.key(1).time;
tEnd = content("Shape 2").content("Trim Paths 1").end.key(2).time;

t = time;
if (time > tEnd){
t = tStart + (time - tEnd)%(tEnd-tStart);
}
valueAtTime(t)

 

 

Translate
S_ A
S_ AAuthor
Inspiring
Feb 13, 2026 4:52 PM UTC

Thank you so much.

Translate