Created
October 23, 2022 18:55
-
-
Save Edudjr/cbc07d8fc50c10f11f14742e0760d1d3 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 AnimationSample: View { | |
@State var firstAnimation = false | |
@State var secondAnimation = false | |
@State var displaySheet = false | |
var body: some View { | |
Text("Testing") | |
.scaleEffect(firstAnimation ? 2 : 1) | |
.foregroundColor(secondAnimation ? .red : .green) | |
.onTapGesture { | |
withAnimation(.linear(duration: 0.5)) { | |
firstAnimation = true | |
} | |
withAnimation(.linear(duration: 0.5).delay(0.5)) { | |
secondAnimation = true | |
displaySheet = true | |
} | |
} | |
.sheet(isPresented: $displaySheet) { | |
Text("Another view!") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment