Leonids icon indicating copy to clipboard operation
Leonids copied to clipboard

Random opacity from range?

Open ShaharAvigezer opened this issue 8 years ago • 3 comments

Hi, great library! Is there a possibility to generate different opacities for the particles?

Thanks!

ShaharAvigezer avatar Dec 18 '16 14:12 ShaharAvigezer

Not out of the box I'm afraid. There is an AlphaModifer (to perform fade in and fade out) but not an AlphaInitializer, which is what you want.

You can create the Initializer yourself and modify the code of ParticleSystem to create it and add it to the initializer list.

Now that I think about it, it makes sense to add a "add generic initializer" method to the ParticleSystem class to allow extensions like the one you are asking for.

plattysoft avatar Dec 18 '16 20:12 plattysoft

Ok, thanks for the reply! Is there any way to set bounds for the animation? for example, I want to keep it only within a certain view.

ShaharAvigezer avatar Dec 19 '16 13:12 ShaharAvigezer

That you can do using the constructor that receives a view Id, in that case the ParticleSystem is created as a child of that View, which means that

a) It is placed at that particular z-index in the hierarchy (original purpose was to put particles on the background) b) It is only as big as the parent (which is what you want)

Note that the parent view must be a ViewGroup, I suggest you use FrameLayout.

plattysoft avatar Dec 20 '16 09:12 plattysoft