6

I want to repeat an animation forever, without it to autoreverse, and with a delay/pause between the repetitions after the animation played.

I know there is a .delay() modifier, but it delays the beginning of the animation:

let ani = Animation.easeInOut.delay(1.0).repeatForever(autoreverses: false)

In addition with the .repeatForever modifier, after the animation played it immediately jumps back to its beginning. But I want the last keyframe to remain visible on the screen for a short amount of time.

I’ve also tried it the other way around, adding a .delay() after the .repeatForever modifier, but without success (delay has no effect).

let ani = Animation.easeInOut.repeatForever(autoreverses: false).delay(1.0)

How can I add a delay after the animation played?

ixany
  • 5,433
  • 9
  • 41
  • 65
  • You can try using `GeometryEffect` for a key frame based animation https://swiftui-lab.com/swiftui-animations-part2/ Swiftui Animation by itself is not easy to synchronize. – lorem ipsum Mar 19 '22 at 11:17
  • Timing curve might do it too https://www.objc.io/blog/2019/09/26/swiftui-animation-timing-curves/ – lorem ipsum Mar 19 '22 at 11:24

0 Answers0