This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let spectrum = Gradient(colors: [Color.mintGreenColor, Color.darkMintColor]) | |
| let conic = AngularGradient(gradient: spectrum, center: .center, angle: .radians(getEndAngle().radians)) | |
| let ring = RingShape(startAngle: getStartAngle(), endAngle: getEndAngle(), ringWidth: ringWidth).fill(conic) | |
| let ringHead = RingHead(endAngle: getEndAngle(), ringWidth: ringWidth).fill(Color.darkMintColor) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var animatableData: Double { | |
| get {return endAngle.radians} | |
| set {endAngle = Angle(radians: newValue)} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private struct RingHead: Shape { | |
| var endAngle: Angle | |
| let ringWidth: CGFloat | |
| var animatableData: Double { | |
| get {return endAngle.radians} | |
| set {endAngle = Angle(radians: newValue)} | |
| } | |
| func path(in rect: CGRect) -> Path { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var body: some View { | |
| let spectrum = Gradient(colors: [ Color.mintGreenColor, Color.darkMintColor]) | |
| let conic = AngularGradient(gradient: spectrum, center: .center, angle: .radians(getEndAngle().radians)) | |
| let ring = RingShape(startAngle: getStartAngle(), endAngle: getEndAngle(), ringWidth: ringWidth).fill(conic) | |
| let ringHead = RingHead(endAngle: getEndAngle(), ringWidth: ringWidth).fill(Color.darkMintColor) | |
| return ring.overlay(ringHead) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private struct ForgroundRingView: View { | |
| var percentage: Double = 0.5 | |
| let ringWidth: CGFloat | |
| var body: some View { | |
| let spectrum = Gradient(colors: [ Color.mintGreenColor, Color.darkMintColor]) | |
| let conic = AngularGradient(gradient: spectrum, center: .center, angle: .radians(getEndAngle().radians)) | |
| let ring = RingShape(startAngle: getStartAngle(), endAngle: getEndAngle(), ringWidth: ringWidth).fill(conic) | |
| return ring |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private struct RingShape: Shape { | |
| var startAngle: Angle | |
| var endAngle: Angle | |
| let ringWidth: CGFloat | |
| var animatableData: Double { | |
| get {return endAngle.radians} | |
| set {endAngle = Angle(radians: newValue)} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let spectrum = Gradient(colors: [Color.mintGreenColor, Color.darkMintColor]) | |
| let conic = AngularGradient(gradient: spectrum, center: .center, angle: .radians(getEndAngle().radians)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private var circleSize: CGFloat { | |
| return (rect.width + (1-scale)*rect.width)/2 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private var circleSize: CGFloat { | |
| return rect.width/2 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var animatableData: AnimatablePair<Double, CGFloat> { | |
| get {return AnimatablePair(petalCount, scale)} | |
| set { | |
| petalCount = newValue.first | |
| scale = newValue.second | |
| } | |
| } |