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

Allow to start and stop the effects programmatically #4

Open
DaemonLoki opened this issue Jun 21, 2022 · 2 comments
Open

Allow to start and stop the effects programmatically #4

DaemonLoki opened this issue Jun 21, 2022 · 2 comments
Labels
feature New feature or request
Projects
Milestone

Comments

@DaemonLoki
Copy link
Collaborator

Having the option to manually start and end the effects allows for more use-cases.
Right now, this is only possible by manipulating the alpha of the effects which is not ideal in terms of both user- and developer-experience.

The idea is to have a .start() and .stop() functionality for all effects. Although different implementations would be necessary for the SpriteKit and CAEmitterLayer based effects, the API has to be the same for making it a streamlined effort for developers to integrate.

@DaemonLoki DaemonLoki added the feature New feature or request label Jun 21, 2022
@DaemonLoki DaemonLoki added this to the v1.1 milestone Jun 21, 2022
@DaemonLoki DaemonLoki added this to To do in Version 1.1 Jun 21, 2022
@Dave181295
Copy link

I was looking to pass a Binding to start/stop the effect.
Yes, as you said, it's necessary.

@DaemonLoki
Copy link
Collaborator Author

That's one approach for sure @Dave181295!

So, what you always can do, is to have a @State property that's conditionally showing the respective effect.
Something in the realm of:

@State private var showingEffect = true
/// ...
if showingEffect {
    ConfettiView()
}
/// ...
.onAppear {
    DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
        withAnimation {
            showingEffect = false        
        }
    }
}

But that would just be a workaround for now, we'll find a better way and expose that in one of the upcoming versions! If you have wishes for the functionality, feel free to add them here! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Development

No branches or pull requests

2 participants