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

Particles all appearing on the left side #59

Closed
Waro1234 opened this issue Oct 10, 2016 · 3 comments
Closed

Particles all appearing on the left side #59

Waro1234 opened this issue Oct 10, 2016 · 3 comments

Comments

@Waro1234
Copy link

Hey man,

so i was trying to implement your particle system (great job on this) but all the particles on the emitwithgravity all appear on the most left part of the screen. Not at all what was shown in previews.

Greetings

@plattysoft
Copy link
Owner

You are likely to be seeing the issue #22 when you start the emitter before the views have been measured.

Check out #22 for explanation and solution.

@Waro1234
Copy link
Author

Waro1234 commented Oct 10, 2016

the following code worked for me:
`private void makeItRain(){

    rainfall.post(new Runnable() {
        @Override
        public void run() {

            ps = new ParticleSystem(MainActivity.this, 800, rainDrop, 10000);
            ps.setAcceleration(0.00013f, 90)
                    .setSpeedByComponentsRange(0f, 0f, 0.05f, 0.1f)
                    .emitWithGravity(rainfall, Gravity.BOTTOM, 30);
        }
    });

}`

rainfall is the view im calling it from.

Thank you for sending me to the thread.

~Cheers

@plattysoft
Copy link
Owner

Be aware that the solution may not work in all devices.

You are posting a Runnable to the UI Thread, so it won't be executed on creation, but there is no guarantee that the Runnable will be executed before the views are measured. Since the measurement is done at the very beginning and it is a simple operation, it would work on most cases, but not all of them.

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