-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProgressCircle.swift
39 lines (32 loc) · 991 Bytes
/
ProgressCircle.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// ProgressCircle.swift
// Download
//
// Created by HEssam on 4/10/24.
//
import SwiftUI
struct ProgressCircle: View {
@Binding private var maxTrim: CGFloat
init(maxTrim: Binding<CGFloat>) {
self._maxTrim = maxTrim
}
private var animation: Animation = {
.easeOut(duration: 4.0)
}()
var body: some View {
ZStack {
HalfCircle()
.trim(from: 0.0, to: maxTrim)
.stroke(.white,
style: .init(lineWidth: 8, lineCap: .round, lineJoin: .round))
.animation(animation, value: maxTrim)
HalfCircle()
.trim(from: 0.0, to: maxTrim)
.stroke(.white,
style: .init(lineWidth: 8, lineCap: .round, lineJoin: .round))
.scaleEffect(x: -1.0, y: 1.0)
.animation(animation, value: maxTrim)
}
.frame(width: 200, height: 200)
}
}