Last active
May 11, 2021 20:57
-
-
Save peantunes/117ca4b54e9718286be5d094f6cd7de3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private struct GroundReflectionViewModifier: ViewModifier { | |
let offsetY: CGFloat | |
func body(content: Content) -> some View { | |
content // base content | |
.background( // using background to duplicate the content with the View | |
content // using the same content here to duplicate | |
// this will create a flip in the axis Y with the anchor in the bottom | |
.scaleEffect(x: 1.0, y: -1.0, anchor: .bottom) | |
// adding the opacity | |
.opacity(0.3) | |
// and receiving the offsetY as parameter | |
.offset(y: offsetY) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment