-
Notifications
You must be signed in to change notification settings - Fork 398
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
Make raining animation #21
Comments
The code looks correct, it actually looks pretty much like the rain example. The only reason that comes to mind for what you are describing is that anchor view is actually on the corner. Try making the cloud view visible and see where it draws. Also, I recall there is one bug about one particular alignment that was fixed in the latest code, did you checked out the last version? Apart from coloring the background of the view and playing with different alignments, there is little more to change. You can always get the rain example and modify it once you see it working. Hope this helps. |
Hi @plattysoft, I find that if I put the code in OnClickListener of the widget, the rain animation will work well. However, if I put this code in other places, example onCreate(), the result will show as I describe above. I want to see my rain without clicking anything. Are there solutions for my problem? Thanks your help. |
Ah, I see the problem, it is due to how Android works. For the particle system to work fine, the views must be measured when it is created. Inside onCreate the Views are not yet measured, just created. You need to set a ViewTreeObserver to know when the layout has been measured. This is a standard question on Android, check out this link on Stack Overflow, it is exactly the same problem: http://stackoverflow.com/questions/3779173/determining-the-size-of-an-android-view-at-runtime |
Hi @plattysoft,
I'm trying to use your lib to make raining animation for my app.
I use below code (I copy from internet):
new ParticleSystem(GoActivity.this, 80, R.drawable.rain, 10000)
.setSpeedByComponentsRange(0f, 0f, 0.05f, 0.1f)
.setAcceleration(0.00005f, 90)
.emitWithGravity(findViewById(R.id.cloud), Gravity.CENTER, 8);
Unfortunately after running code, my drop image appeared only left side of the screen and it showed a half of it.
Can you help me solve this problem?
Thank you
The text was updated successfully, but these errors were encountered: