Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SarahAlsharif/5acd0fb007069ba87ff487b78d1c15c8 to your computer and use it in GitHub Desktop.
Save SarahAlsharif/5acd0fb007069ba87ff487b78d1c15c8 to your computer and use it in GitHub Desktop.
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