Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import SwiftUI
struct ContentView: View {
var body: some View {
Canvas { context, size in
var path = Path()
let center = CGPoint(x: size.width/2, y: size.height/2)
for i in 0..<720 {
let angle = Double(i) * 0.1
let radius = Double(i) * 0.3
let x = center.x + CGFloat(cos(angle) * radius)
let y = center.y + CGFloat(sin(angle) * radius)
i == 0 ? path.move(to: CGPoint(x: x, y: y)) : path.addLine(to: CGPoint(x: x, y: y))
}
context.stroke(path, with: .color(.red), lineWidth: 3)
}
}
}Coding works best on desktop or with an external keyboard.