It’s parfetti time!

Jin Cao
Jin Cao
Aug 30, 2016 · 3 min read

The actual name is Confetti, but one of my friends thinks that parfetti is a much more clever name.

Image for post
Image for post
Simple raining confetti (included in sample project)

In between intensely working on Robinhood Gold (in case anyone is wondering, that picture isn’t me, I wish that I signed up to be tattooed) and waiting on design/copy/everything to be finalized, I had some time on my hands to work on my second open-source project that will be used at Robinhood. I am happy to say that I released it today for all of you guys to try it out!

Eh, what is it?

In it’s simplest form, Confetti is a particle system/emitter library that can be configured to emit arbitrary confetti anywhere, any time. It’s easily customizable and very powerful. For example, you can specify any arbitrary emission source (a point or a line), any initial physics constraints (velocity, acceleration, rotation, etc.), and any implementation of the Confetto (yes, it’s actually a real word, and it’s the singular form of confetti), and the library will emit, display, and animate your specified confetti onto the screen!

Here’s a sample configuration for an explosion:

new ConfettiManager(context, generator, confettiSource, container)
.setVelocityX(0, defaultVelocityFast)
.setVelocityY(0, defaultVelocityFast)
.setRotationalVelocity(180, 180);

And here’s the result:

Image for post
Image for post
Explosion confetti (included in sample project)

Cool customizations

You should read the Github README for more detailed documentation.

The primary way to customize this library for your use-case is to set the various configuration variables on the ConfettiManager to suit your animation needs. You can use a bitmap for your confetto, or provide a custom implementation of the Confetto class (see BitmapConfetto for an example implementation).

Some supported attributes include a fade-out behavior as the confetto reaches its bounds or TTL (time to live) and touch & drag. Here’s an example of the custom touch and drag behavior:

Image for post
Image for post
Confetti with touch & drag

You can essentially use this library to power some of the cool popular features such as the flying hearts on Periscope or the falling money animation on Facebook Messenger.


We always care about performance at Robinhood. The confetti manager internally recycles confetto objects so that an infinite stream of confetti won’t wreck the device’s memory. Furthermore, since each confetto only needs to know how to draw the bitmap, you only need to allocate each bitmap (in the case of bitmap confetti) once. Finally, we pre-compute many required animation parameters (e.g. time to reach bound) so that the calculation for each animation update is super straightforward. All in all, you shouldn’t have to worry about dropped frames unless you have many many pieces of confetti on your screen at once.

Well, that’s all for now. Submit issues here if you have any feature requests or find bugs in the library. Happy Android-ing!

Image for post
Image for post
No emojis on Medium :(

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store