-
-
Save sturdysturge/1ec25b98a3b055db901809df7f035b44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct AquaBrushedMetalShape: Shape { | |
func path(in rect: CGRect) -> Path { | |
Path { | |
path in for _ in stride(from: 0, to: Int(rect.height), by: 5) { | |
let y = CGFloat.random(in: rect.minY...rect.maxY) | |
let curveEnd = CGPoint(x: rect.maxX, y: y) | |
let controlOffset = CGFloat.random(in: -25...25) | |
let controlPoint = CGPoint(x: rect.midX, y: y + controlOffset) | |
path.move(to: CGPoint(x: rect.minX, y: y)) | |
path.addQuadCurve(to: curveEnd, control: controlPoint) | |
} | |
} | |
} | |
} | |
struct AquaBrushedMetalView: View { | |
let gradient = Gradient( | |
colors: [.aquaTransparentWhite, | |
.aquaTranslucentWhite, | |
.aquaTransparentWhite]) | |
var body: some View { | |
ZStack { | |
Color.aquaGray | |
AquaBrushedMetalShape() | |
.stroke(Color.aquaBrushedMetalStroke, lineWidth: 2) | |
LinearGradient(gradient: gradient , | |
startPoint: .leading, | |
endPoint: .trailing) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment