Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import SwiftUI
struct ContentView: View {
var body: some View {
Canvas { context,size in
var path=Path()
for x in stride(from:0.0,to:size.width,by:1){
let y=size.height/2+CGFloat(sin(x*0.05)*40+sin(x*0.08)*40)
x==0 ? path.move(to:CGPoint(x:x,y:y)) : path.addLine(to:CGPoint(x:x,y:y))
}
context.stroke(path,with:.color(.cyan),lineWidth:2)
}
}
}Coding works best on desktop or with an external keyboard.