celebration animation in android studio

Viewed 2617

I am developing a small stone paper scissor game. Only one mode - user vs computer.

If the user wins.. in the last activity i want to display "USER WINS". This much is done.

I want to display ribbons animation all over the screen, overlapping the "USER WINS" text. How do I code that?

1 Answers

i have found this lib for your requirement

follow here

tip: try to search before asking questions

how to implement

import gradle

 implementation 'nl.dionsegijn:konfetti:1.1.2'

and in you java

viewKonfetti.build()
.addColors(Color.YELLOW, Color.GREEN, Color.MAGENTA)
.setDirection(0.0, 359.0)
.setSpeed(1f, 5f)
.setFadeOutEnabled(true)
.setTimeToLive(2000L)
.addShapes(Shape.RECT, Shape.CIRCLE)
.addSizes(new Size(12, 5))
.setPosition(-50f, viewKonfetti.getWidth() + 50f, -50f, -50f)
.streamFor(300, 5000L)

add this to your xml

<nl.dionsegijn.konfetti.KonfettiView
    android:id="@+id/viewKonfetti"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
Related