Skip to content

Instantly share code, notes, and snippets.

@SarahAlsharif
Last active February 1, 2022 12:19
Show Gist options
  • Save SarahAlsharif/990cd0d4bfa8b15652cda38dc4c20d8c to your computer and use it in GitHub Desktop.
Save SarahAlsharif/990cd0d4bfa8b15652cda38dc4c20d8c to your computer and use it in GitHub Desktop.
struct ShallowConcaveView : View {
let cornerRadius : CGFloat
var body: some View {
ZStack {
RoundedRectangle(cornerRadius: cornerRadius)
.fill(Color(Colors.mainColor))
RoundedRectangle(cornerRadius: cornerRadius)
.stroke(Color(Colors.darkShadow), lineWidth: 2)
.blur(radius: 0.5)
.offset(x: 1, y: 0.5)
.mask(RoundedRectangle(cornerRadius: cornerRadius).fill(LinearGradient(colors: [Color(Colors.darkShadow), Color.clear], startPoint: .top, endPoint: .bottom)))
RoundedRectangle(cornerRadius: cornerRadius)
.stroke(Color(Colors.lightShadow), lineWidth: 2)
.blur(radius: 0.5)
.offset(x: -1, y: -1.5)
.mask(RoundedRectangle(cornerRadius: cornerRadius).fill(LinearGradient(colors: [Color.clear, Color(Colors.lightShadow)], startPoint: .top, endPoint: .bottom)))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment