Drawing a pie isn't difficult if I do it with Path.
import SwiftUI
struct ContentView8: View {
var body: some View {
PieSlice(start: .degrees(-90), end: .degrees(120))
.fill(.pink)
}
}
struct PieSlice: Shape {
let start: Angle
let end: Angle
func path(in rect: CGRect) -> Path {
var path = Path()
let center = CGPoint(x: rect.midX, y: rect.midY)
path.move(to: center)
path.addArc(center: center, radius: rect.midX, startAngle: start, endAngle: end, clockwise: false)
return path
}
}
Actually, I want to animate this pie such that it will gradually deploy starting at -90 degrees. In the code above, I suppose I cannot animate the pie because the PieSlice guy isn't a View. Or can I? If I can't, is there an alternative way of drawing a pie so that I can animate it?
Thanks a million.
Señor Tomato Source
Hostage Negotiator at
Tomato Source Association of North America