__smm_static_temp_content__

Modes

The mode option controls what happens when the animation reaches or exceeds the end of the path.

'clamp' (default)

Stops at the end of the path and holds the final position.

const fp = new FollowPath({
  // ...
  mode: 'clamp'
});

'loop'

Wraps around to the start each time the end is reached, creating a seamless repeat.

const fp = new FollowPath({
  // ...
  mode: 'loop'
});

'pingpong'

Reverses direction on each iteration, creating a back-and-forth effect.

const fp = new FollowPath({
  // ...
  mode: 'pingpong'
});

Custom function

Provide your own function to handle exceeded progress values manually. Receives the raw exceeded value and must return a clamped/remapped value.

const fp = new FollowPath({
  // ...
  mode(t) {
    return t > 1 ? 1 - (t % 1) : t;
  }
});