Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change size of particles in Leonids Particle System Lib #40

Open
malomasti opened this issue Mar 2, 2016 · 1 comment
Open

Change size of particles in Leonids Particle System Lib #40

malomasti opened this issue Mar 2, 2016 · 1 comment

Comments

@malomasti
Copy link

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?

@dgcooke
Copy link

dgcooke commented May 24, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants