Hi everyone,
I'd like to create a looped animation that can be paused. I achieved it with the new phaseAnimator function, and it works well, except for the pause.
I tried to use the trigger
option, but it stops the loop process.
I tried to use a local @State var isAnimating: Bool
variable, and return something like this
Circle() .phaseAnimator(States.allValues, content: { content, state in if isAnimating { // do whatever animation } else { content } }, animation: { state in guard isAnimating else { return nil } // no animation // return the desired animation for the state }
For some reasons, when I stop the animation, it enters some kind of infinite loop that crashes the app.
I then tried to add a pause
case to my enum and return no animation and no AnimationCurve when using this mode. Same as before (crashes when pausing)
Do you know how can I achieve that (pausable looped animation) ? Maybe phaseAnimation is not the way to go ?
Thanks