Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confetti Animation Staggers When Bursted During a Push Animation #33

Open
emrepun opened this issue Feb 21, 2025 · 0 comments
Open

Confetti Animation Staggers When Bursted During a Push Animation #33

emrepun opened this issue Feb 21, 2025 · 0 comments

Comments

@emrepun
Copy link

emrepun commented Feb 21, 2025

I don't know if this is known, but there is a bit of a lag when confetti animation is triggered onAppear and view is being pushed onto navigation stack. Please see the recording at the end for reference.

Code:

struct PushedContentView: View {
    var body: some View {
        ZStack {
            VortexViewReader { proxy in
                VortexView(.confetti.makeUniqueCopy()) {
                    Rectangle()
                        .fill(.white)
                        .frame(width: 16, height: 16)
                        .tag("square")
                    
                    Circle()
                        .fill(.white)
                        .frame(width: 16)
                        .tag("circle")
                }
                .padding(.top, -384.0)
                .onAppear {
                    proxy.burst()
                }
            }
            ScrollView {
                // Redacted: Actual content of the view
            }
        }
    }
}

Additional details (might be useful): The navigation is handled by a UINavigationController, so view above is embedded in a UIHostingController and pushed to the stack with UIKit.

As a workaround I added a 0.5 seconds of delay before triggering the burst, which fixes the issue

Recording (The lag seems even worse in recording, but o simulator or device it is not that bad):

confetti_delay.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant