Skip to content
Celebrate more with this lightweight confetti particle system 🎊
Kotlin Java
Branch: master
Clone or download

Latest commit

dependabot-preview and DanielMartinus Bump gradle-bintray-plugin from 1.8.4 to 1.8.5
Bumps gradle-bintray-plugin from 1.8.4 to 1.8.5.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Latest commit 2fe8e01 Apr 6, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Update docker image Apr 29, 2019
.github/workflows Add gradle wrapper validation Apr 5, 2020
.idea Update gradle wrapper Mar 5, 2020
demo-google-play Update sdk and buildtools to 29 Mar 7, 2020
demo-simple-java Update sdk and buildtools to 29 Mar 7, 2020
gradle Update gradle wrapper Mar 5, 2020
konfetti Bump mockito-core from 3.3.1 to 3.3.3 Mar 14, 2020
media Add demo gif May 28, 2017
.gitignore Ignore DS_Store Apr 29, 2019
LICENSE Update LICENSE May 28, 2017
README.md Set version in readme to v1.2.0 Mar 7, 2020
build.gradle Bump gradle-bintray-plugin from 1.8.4 to 1.8.5 Apr 7, 2020
gradle.properties Migrate to androidx Jan 4, 2020
gradlew Update gradle to 4.7 May 2, 2018
gradlew.bat Update gradle to 4.7 May 2, 2018
settings.gradle Rename project modules Jul 10, 2017

README.md

Konfetti 🎊

platform API License: ISC Awesome Kotlin Badge Twitter

For more updates on this and other open-source projects, follow me on twitter πŸ‘‰ here


Celebrate more with this lightweight confetti particle system 🎊 Create realistic confetti by implementing this easy to use library.

Demo app

Sample app

Download on Google Play:

Android app on Google Play

Or download the APK here

Usage

XML

All you need in your layout is the KonfettiView to render the particles on:

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

Example in Kotlin

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

Example in Java

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

Custom shapes

Add a custom shape by using:

Shape.DrawableShape(drawable: Drawable)

The 3D flip effect works best for symmetrical shapes, for example a drawable with a width and a height of 24x24.

Download

Add the following dependency in your app's build.gradle

dependencies {
      implementation 'nl.dionsegijn:konfetti:1.2.0'
}

Download

Java project

If you haven't configured Kotlin for your Java only project, add the following to your project:

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:$latest_version'

Read more about the latest version and kotlin via gradle here: https://kotlinlang.org/docs/reference/using-gradle.html

Contribute

There is always room for improvement.

Report issue

Did you encounter bugs? Report them here. The more relevant information you provide the easier and faster it can be resolved.

Contribute

As mentioned, there is always room for improvement. Do you have any performance improvement ideas? Please suggest them here. Before submitting a large Pull Request, creating an issue to discuss your ideas would be the preferred way so we can be sure it is in line with other improvements currently being developed. Is it a simple improvement? Go ahead and submit a Pull Request! I very welcome any contributions.

Roadmap

In line with the previous contribute section there are some already known issues that could be resolved and are open for discussion.

  • Determining the size of the particles in the current implementation is not ideal. More here: #7 Confetti size system
  • A performance improvement to the library could for one be to implement a shared object pool amongst all particle systems instead of having them to handle confetti instances themselves.

License

Konfetti is released under the ISC license. See LICENSE for details.

You can’t perform that action at this time.