Created
February 9, 2022 16:08
-
-
Save SarahAlsharif/5acd0fb007069ba87ff487b78d1c15c8 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
struct LikesModifier: ViewModifier { | |
@State var time = 0.0 | |
let duration = 2.0 | |
func body(content: Content) -> some View { | |
ZStack { | |
ForEach(0..<2) { _ in | |
content | |
.foregroundColor(.white) | |
.modifier(LikesGeometryEffect(time: time)) | |
.opacity(time == duration ? 0 : 1) | |
} | |
} | |
.onAppear { | |
withAnimation (.easeOut(duration: duration)) { | |
self.time = duration | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment