The animation is working fine for most users but it's flickering for a few. This is how it's flickering and how it should idly look:
Here's the code:
ZStack {
Circle()
.fill(Color.white.opacity(0.6))
.frame(width: state == .paused ? 0 : width() / 2, height: state == .paused ? 0 : width() / 2)
.animation(.default, value: state)
if state == .notStarted {
(Text(viewModel.book.currentPositionText()) + Text(": \(viewModel.book.toProgressText(progress: Float(viewModel.book.currentPositionValue())))"))
.largeWhiteHeading()
.padding(.top, width()/2 + 88)
}
Circle()
.stroke(Color.white, lineWidth: 2)
.frame(width: viewModel.timerOnAnimState ? width() - 32 : width() / 2, height: viewModel.timerOnAnimState ? width() - 32 : width() / 2)
.opacity(viewModel.timerOnAnimState ? 0 : 0.6)
.animation(viewModel.timerOnAnimState ? rippleAnimation : .default, value: viewModel.timerOnAnimState)
Circle()
.stroke(Color.white, lineWidth: 2)
.frame(width: viewModel.timerOnAnimState ? width() - 32 : width() / 2, height: viewModel.timerOnAnimState ? width() - 32 : width() / 2)
.opacity(viewModel.timerOnAnimState ? 0 : 0.6)
.animation(viewModel.timerOnAnimState ? rippleAnimation.delay(2.0) : .default, value: viewModel.timerOnAnimState)
Text(viewModel.time)
.onReceive(viewModel.timer, perform: { _ in
if viewModel.sessionState == .inProgress {
viewModel.updateTime()
}
})
.foregroundColor(Color.primaryText)
.font(.custom(RMFont.Pacifico_Regular, size: 48))
}
.opacity(state == .paused ? 0 : 1)
.animation(.default, value: state)
Any help would be appreciated.