Leonids icon indicating copy to clipboard operation
Leonids copied to clipboard

Change size of particles in Leonids Particle System Lib

Open malomasti opened this issue 8 years ago • 1 comments

I am using the Leonids Particle System Lib, using the JAR library. When you use, for example, the .OneShot function, as in:

new ParticleSystem(Activity.this, 200, R.drawable.particle, (int)(t_star/2.0f)) .setSpeedRange(0.1f, 0.2f) .oneShot(view, time);

the lib loads the R.drawable.particle, and emits the oneshot with the exact height and width in pixels than the original image. I want to control the exact size of the particles, since the effect should be different depending on the density of the used device (and LDPI, MDPI, etc. are not the exact approach, since the exact size control is desired)

Is if there are any ways to change the width or height of the particles in px or dp?

malomasti avatar Mar 02 '16 11:03 malomasti

This is how I do it, may not be the best way but it works.

Bitmap chestImage = BitmapFactory.decodeResource(PerformanceActivity.this.getResources(),R.drawable.dust_circle_centre_fuchsia); Bitmap resizedChestImage = Bitmap.createScaledBitmap(chestImage, 20, 20, false);

new ParticleSystem(PerformanceActivity.this, 10, resizedChestImage, 4000,R.id.frameView) .setInitialRotationRange(0, 360) .addModifier(new AlphaModifier(255, 0, 200, 4000)) .addModifier(new ScaleModifier(1.0f, 2f, 0, 3000)) .oneShot(frontImageView, 4);

Hope it Helps Damien

dgcooke avatar May 24 '16 06:05 dgcooke