# Looping an animated spline trim curve with a small delay for the start in geometry nodes

I'm having trouble looping an animation on a trim curve for a spline with geo nodes. I basically want the end of the trim to go from 1 to 0, then wait (a little delay) for the start to go for 0 to 1, so it looks like a segment is moving. Eventually, I'll apply this for multiple splines all moving at their random speed. (but I think I can manage to do that). I keep trying and no success. I think I don't master math and modulo enough.

Like in this example: https://i.stack.imgur.com/RBNuf.jpg

• Hello and welcome. Instead of having users go through links and external sites please use the builtin tools to embed images in your post. See How to upload an image to a post? or GIFs Mar 15, 2022 at 22:09
• @DuarteFarrajotaRamos sorry about that, I wanted to post a video and didn’t think the builtin tools would have permit that. Mar 16, 2022 at 0:01

with this node setup: you will get this: I did a bit commenting about the math in the nodes.

I think the green nodes are easy to understand, the tricky part might be the math. The frame will be divided by 100. So the output of the divide will be 0.01, 0.02, 0.03 and so on. The fraction results just the decimals, so the value will never be 1.01, 1.02 but instead 0.01, 0.02. After that the interval will be extended by 1.3 so i have values now from 0 to 1.3 (ok 1.3 * 0.99 exactly) instead of 0 to 0.99. Then the length of the animated curve will be subtracted to define the start value of the trim curve (which can be from 0 to 1, that's why we subtract that 0.3 again to get the 0 at frame 0 (because we lengthen the interval before by 0.3 by multiplying it with 1.3). Now we just add the 0.3 again (the length of the curve) to set the end value. Easy right? ;)

• Oh wow, I'm not quite sure I understand the idea behind all of the math, but will try to integrate that and create a node group out of it. Thnaks ! Mar 16, 2022 at 12:58

many ways to do it, but to offset in time the 'end' animation just add some value... 