Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import SwiftUI
struct ContentView: View {
let golden = Double.pi*(3-sqrt(5.0))
var body: some View {
Canvas { context,size in
let c = CGPoint(x:size.width/2,y:size.height/2)
for i in 0..<800 {
let r = sqrt(Double(i))*5
let a = Double(i)*golden
let x = c.x + CGFloat(cos(a)*r)
let y = c.y + CGFloat(sin(a)*r)
context.fill(Path(ellipseIn:CGRect(x:x,y:y,width:4,height:4)),with:.color(.yellow))
}
}
}
}Coding works best on desktop or with an external keyboard.