Skip to content

Commit

Permalink
TUIChirculatProgresView
Browse files Browse the repository at this point in the history
 - Updated with rotationDegrees
  • Loading branch information
maheshwaran01m committed Nov 5, 2024
1 parent e1dd355 commit 83b1ffb
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public struct TUICircularProgressView<Label: View>: View {
var style: TUICircularProgressViewStyle = .indeterminate

private let lineWidth: CGFloat = 4
@State private var isAnimating: Bool = false

@State private var rotationDegrees = 0.0

/// Creates a circular progress view with the specified progress and label.
///
Expand Down Expand Up @@ -81,12 +82,17 @@ public struct TUICircularProgressView<Label: View>: View {
}
} else {
circularView
.rotationEffect(.degrees(isAnimating ? 360 : 0))
.animation(.linear(duration: 1)
.speed(0.5)
.repeatForever(autoreverses: false), value: UUID())
.rotationEffect(.degrees(rotationDegrees))
.onAppear {
isAnimating = true
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
withAnimation(
.linear(duration: 1)
.speed(0.5)
.repeatForever(autoreverses: false)
) {
self.rotationDegrees = 360.0
}
}
}
}
}
Expand Down

0 comments on commit 83b1ffb

Please sign in to comment.