Konfetti icon indicating copy to clipboard operation
Konfetti copied to clipboard

Use colors with an alpha value

Open cplachta opened this issue 7 years ago • 5 comments

I can't seem to use any colors with transparency, how would I go about doing this?

Thanks!

cplachta avatar Jun 05 '18 14:06 cplachta

Hmm, interesting. Technically you can use color integers for Konfetti but the system is currently manipulating the alpha level in Particle.kt here.

I assume you have different colors of which some have different alpha values. This is an interesting use case that I didn't think of when making this.

I can either:

  • Apply a fix so that the alpha value is not set when you turn this off with a setting when creating the particle system
  • The alpha value is manipulated based on the alpha value of the color

The latter works for most use cases but requires some work. Let me know if you have any ideas

DanielMartinus avatar Jun 06 '18 12:06 DanielMartinus

I was thinking maybe you could leave the alpha value of the color and instead of changing the alpha on each particle, could you manipulate the alpha value of the KonfettiView for the fadeOut?

cplachta avatar Jun 06 '18 15:06 cplachta

Unfortunately the fade out has to happen for each particle individually since they each have a different lifespan and moment to disappear.

DanielMartinus avatar Jun 06 '18 23:06 DanielMartinus

Ah okay. Then yeah, the second option would probably work (using the alpha value of the color).

cplachta avatar Jun 07 '18 21:06 cplachta