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

emmitWithGravity error. #53

Closed
Barterio opened this issue Jul 14, 2016 · 2 comments
Closed

emmitWithGravity error. #53

Barterio opened this issue Jul 14, 2016 · 2 comments

Comments

@Barterio
Copy link

Hi, i'm using Leonids to create background raining animation.
The problem is that all particles are running from the top left corner one by one. Can you help me handle it?

new ParticleSystem(MainActivity.this, 50, R.mipmap.ic_launcher, 5000)
                .setAcceleration(0.00013f, 90)
                .setSpeedByComponentsRange(0f, 0f, 0.05f, 0.1f)
                .setFadeOut(200, new AccelerateInterpolator())
                .emitWithGravity((Button)findViewById(R.id.mainForeground), Gravity.BOTTOM, 20);
@plattysoft
Copy link
Owner

The most likely problem is that you are starting the emitter inside onCreate or onStart.
At that moment, the views are not yet measured, therefore the system read the width of the view as 0.
You need to wait until the views are measured. Check out #22

@Barterio
Copy link
Author

Thank you for your response!
I was thinking about this in that way, so thank you for your explanation answer!

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