Konfetti Versions Save

Celebrate more with this lightweight confetti particle system 🎊

v1.2.1

3 years ago

Added

  • ae8ca95 Stream for an indefinite amount of time when using streamFor by using StreamEmitter.INDEFINITE
  • a8cf9d1 Stop all particles from rendering gracefully and live out their lifetime by calling stopGracefully() on KonfettiView or a RenderSystem
  • 3f04a65 KonfettiView can now be extended since it's made open
  • 7f7e8c7 Disable 3D rotations of the confetti particles by calling .setRotationEnabled(false)

Fixes

  • caf8992 Fix streamMaxParticles isFinished check

v1.2.0

4 years ago

Added

Changes

Minor API change, old ones still work due to backwards compatibility.

Before Becomes
Shape.RECT Shape.Square
Shape.CIRCLE Shape.Circle

Add a custom drawable like this:

val drawable = ContextCompat.getDrawable(context, R.drawable.star)
val star = Shape.DrawableShape(drawable)

viewKonfetti.build()
             ...
            .addShapes(star)
            .streamFor(300, 5000L)

If you want to keep the original colours of the drawable set tinting to false. This is by default set to true.

val drawable = ContextCompat.getDrawable(context, R.drawable.gradientDrawable)
Shape.DrawableShape(drawable, false)

v1.1.3

5 years ago

Minor improvements in this release.

Added

v1.1.2

6 years ago

New contribution from @jurriaan

Enhancements

  • (#50) Update build-tools, kotlin version and dependencies

This update removes the following warning:

2.1/org.jetbrains.kotlin/kotlin-stdlib-jre7/1.2.0/ec8b969e26fbcf2265a4d1a1539c4d1d4c5af380/kotlin-stdlib-jre7-1.2.0.jar: kotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 instead

1.1.1

6 years ago

Small release with a couple of enhancements

Added

Enhancements

1.1.0

6 years ago

Added

Fixed issue

Removed

I want to thank everyone who took the time to submit a pull request or reported an issue. Really appreciated 👏

Custom emiter

With this pull request you're able to add your own custom emitter to Konfetti.

/**
 * Created by dionsegijn on 9/03/17.
 *
 * An abstract class for creating a custom emitter
 * The only goal of the emitter is to tell when and how many particles to create
 */
abstract class Emitter {

    /**
     * Call this function to tell the RenderSystem to render a particle
     */
    var addConfettiFunc: (() -> Unit)? = null

    /**
     * This function is called on each update when the [RenderSystem] is active
     * Keep this function as light as possible otherwise you'll slow down the render system
     */
    abstract fun createConfetti(deltaTime: Float)

    /**
     * Tell the [RenderSystem] when the emitter is done creating particles
     * @return true if the renderSystem is not longer creating any particles
     *         false if the renderSystem is still busy
     */
    abstract fun isFinished(): Boolean
}

See BurstEmitter or StreamEmitter for examples

To start using your custom Emitter, call the following function in ParticleSystem and supply it with your custom emitter:


/**
 * Add your own custom Emitter. Create your own class and extend from [Emitter]
 * See [BurstEmitter] and [StreamEmitter] as example classes on how to create your own emitter
 * By calling this function the system wil start rendering the confetti according to your custom
 * implementation
 * @param [emitter] Custom implementation of the Emitter class
 */
fun emitter(emitter: Emitter) {
    startRenderSystem(emitter)
}

Calling your custom emitter will look something like this:

viewKonfetti.build()
    .addColors(Color.YELLOW, Color.GREEN, Color.MAGENTA)
    ... // other properties
    .emitter(CustomEmitter())

1.0.2

6 years ago

Added

1.0.1

6 years ago

Added

1.0

6 years ago

Initial release 🎉 🎊