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

Best approach to programatically start the effects? #305

Open
zoltish opened this issue Feb 8, 2023 · 0 comments
Open

Best approach to programatically start the effects? #305

zoltish opened this issue Feb 8, 2023 · 0 comments

Comments

@zoltish
Copy link

zoltish commented Feb 8, 2023

Consider a scenario where the user can click a button to start (or restart) the effects, how would I best go about doing that? Current, a bit hackish approach is below. It doesnt seem to have any issues really, but it just seems very ineffective (Im testing on a Pixel 7, lower end devices will likely explode after a while).

    var count by remember {
            mutableStateOf(1)
        }

        repeat(count) {
            KonfettiView(
                modifier = Modifier
                    .fillMaxSize()
                    .clickable(
                        indicate = false,
                        onClick = {
                            count++
                        },
                    ),
                parties= ...
            )
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants