Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
struct AquaWaveShape: Shape {
func path(in rect: CGRect) -> Path {
Path {
path in
path.move(to: CGPoint(x: rect.minX, y: rect.maxY * 0.9))
path.addQuadCurve(to: CGPoint(x: rect.maxX * 0.25, y: rect.midY),
control: CGPoint(x: rect.minX, y: rect.midY))
path.addLine(to: CGPoint(x: rect.maxX * 0.75, y: rect.midY))
path.addQuadCurve(to: CGPoint(x: rect.maxX, y: rect.maxY * 0.1),
control: CGPoint(x: rect.maxX, y: rect.midY))
path.addLine(to: CGPoint(x: rect.maxX, y: rect.minY))
path.addLine(to: CGPoint(x: rect.minX, y: rect.minY))
path.addLine(to: CGPoint(x: rect.minX, y: rect.maxY))
}
}
}
struct AquaWaveView: View {
var body: some View {
ZStack {
LinearGradient(gradient: Gradient(colors: [.gray, .white]),
startPoint: .top, endPoint: .bottom)
Color.aquaLightGray
.mask(AquaWaveShape())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment