-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCircleProgressBarView.swift
More file actions
41 lines (33 loc) · 1.08 KB
/
CircleProgressBarView.swift
File metadata and controls
41 lines (33 loc) · 1.08 KB
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
40
//
// CircleProgressBarView.swift
// University Grade Calculator
//
// Created by tal barmocha on 25/08/2023.
//
import SwiftUI
struct CircleProgressBarView: View {
@ObservedObject var settings: GameSettings
var fraction: Double
var whole: Double
var body: some View {
ZStack {
Circle()
.stroke(lineWidth: 3)
.opacity(0.3)
.foregroundColor(Color.orange)
Circle()
.trim(from: 0.0, to: CGFloat(fraction/whole))
.stroke(style: StrokeStyle(lineWidth: 3, lineCap: .round, lineJoin: .round))
.foregroundColor(Color.orange)
.rotationEffect(Angle(degrees: 270.0))
.animation(.spring(), value: fraction)
}.frame(width: 45 , height: 45)
}
}
struct CircleProgressBarView_Previews: PreviewProvider {
static var previews: some View {
CircleProgressBarView(settings:GameSettings(),fraction: 65.0,whole: 100)
.previewLayout(.sizeThatFits)
.padding()
}
}