mirror of https://github.com/oxen-io/session-ios
WIP: refactor activity indicator
parent
03ab6d7372
commit
e7bddfd4a6
@ -0,0 +1,37 @@
|
||||
// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
|
||||
|
||||
import SwiftUI
|
||||
|
||||
public struct ActivityIndicator: View {
|
||||
@State private var isAnimating: Bool = false
|
||||
|
||||
public var body: some View {
|
||||
GeometryReader { (geometry: GeometryProxy) in
|
||||
ForEach(0..<5) { index in
|
||||
Group {
|
||||
Circle()
|
||||
.frame(
|
||||
width: geometry.size.width / 5,
|
||||
height: geometry.size.height / 5
|
||||
)
|
||||
.scaleEffect(!self.isAnimating ? 1 - CGFloat(index) / 5 : 0.2 + CGFloat(index) / 5)
|
||||
.offset(y: geometry.size.width / 10 - geometry.size.height / 2)
|
||||
}
|
||||
.frame(
|
||||
width: geometry.size.width,
|
||||
height: geometry.size.height
|
||||
)
|
||||
.rotationEffect(!self.isAnimating ? .degrees(0) : .degrees(360))
|
||||
.animation(Animation
|
||||
.timingCurve(0.5, 0.15 + Double(index) / 5, 0.25, 1, duration: 1.5)
|
||||
.repeatForever(autoreverses: false)
|
||||
)
|
||||
}
|
||||
}
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.onAppear {
|
||||
self.isAnimating = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue