-
-
Save sturdysturge/0ea48efc3a5a713ac343b826421560a9 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
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