Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import SwiftUI
struct ContentView: View {
var body: some View {
Canvas { context,size in
var x = 0.0
var y = 0.0
for _ in 0..<50000 {
let r = Double.random(in:0...1)
let nx: Double
let ny: Double
switch r {
case 0..<0.01: nx = 0; ny = 0.16*y
case 0..<0.86: nx = 0.85*x+0.04*y; ny = -0.04*x+0.85*y+1.6
case 0..<0.93: nx = 0.2*x-0.26*y; ny = 0.23*x+0.22*y+1.6
default: nx = -0.15*x+0.28*y; ny = 0.26*x+0.24*y+0.44
}
x = nx; y = ny
let p = CGRect(x: size.width/2+CGFloat(x*45), y: size.height-CGFloat(y*45), width: 1, height: 1)
context.fill(Path(p), with:.color(.green))
}
}
}
}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