WIP: loading
This commit is contained in:
parent
cff9367c99
commit
b7940e52ae
|
@ -7,26 +7,25 @@ public struct ActivityIndicator: View {
|
|||
|
||||
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)
|
||||
}
|
||||
Circle()
|
||||
.trim(from: 0, to: 0.9)
|
||||
.stroke(
|
||||
themeColor: .borderSeparator,
|
||||
style: StrokeStyle(
|
||||
lineWidth: 2,
|
||||
lineCap: .round
|
||||
)
|
||||
)
|
||||
.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)
|
||||
.timingCurve(0.5, 1, 0.25, 1, duration: 1.5)
|
||||
.repeatForever(autoreverses: false)
|
||||
)
|
||||
}
|
||||
}
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.onAppear {
|
||||
|
|
|
@ -16,4 +16,11 @@ public extension Shape {
|
|||
ThemeManager.currentTheme.colorSwiftUI(for: themeColor) ?? Color.primary
|
||||
)
|
||||
}
|
||||
|
||||
func stroke(themeColor: ThemeValue, style: StrokeStyle) -> some View {
|
||||
return self.stroke(
|
||||
ThemeManager.currentTheme.colorSwiftUI(for: themeColor) ?? Color.primary,
|
||||
style: style
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue