Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import SwiftUI
struct ContentView: View {
var body: some View {
Canvas { context, size in
let R = 120.0
let r = 45.0
let d = 60.0
let center = CGPoint(x: size.width/2, y: size.height/2)
var path = Path()
for t in stride(from: 0.0, through: 40*Double.pi, by: 0.02) {
let x = (R-r)*cos(t)+d*cos((R-r)/r*t)
let y = (R-r)*sin(t)-d*sin((R-r)/r*t)
let p = CGPoint(x: center.x+CGFloat(x), y: center.y+CGFloat(y))
t == 0 ? path.move(to: p) : path.addLine(to: p)
}
context.stroke(path, with: .color(.red), lineWidth: 2)
}
}
}Coding works best on desktop or with an external keyboard.
~`
!1
@2
#3
$4
%5
^6
&7
*8
(9
)0
_-
+=
⌫
Tab
Q
W
E
R
T
Y
U
I
O
P
{[
}]
|\
Caps
A
S
D
F
G
H
J
K
L
:;
"'
↵
⇧
Z
X
C
V
B
N
M
<,
>.
?/
⇧
Ctrl
⊞
Alt
␣
Alt
⊞
Ctx
Ctrl
left
👉Middle
i
right
L Pinky
L Ring
L Middle
L Index
Thumb
R Index
R Middle
R Ring
R Pinky