Comments (6)
If you need me to provide Video and Log file, just me know!
from leonids.
This works as intended.
A particle system does create a pool of particles and attaches itself to the view hierarchy. It is meant to be used in one of the following ways:
- As a continuous emitter for as long as the view is active
- As a oneShot that is used once when the view is active
- As a oneShot that is triggered several times
If you want to create multiple particle systems and make them auto-release once the oneShot is completed, you need to add a listener there and remove the particle system from the View hierarchy.
As I said, that is not the way it is intended to work, you should create a few particle systems and reuse them, but if you really want to go that way, the solution is what I stated before.
from leonids.
Dear Mr Raul,
Thank you very much for your detail explanation.
First of all, I tried to define ParticleSystem object in onCreate rather
than in onTouch in your example but it will lead to force close program.
Second thing is with oneShot it doesn't specify emit point position like
emit(). Which I do is using only one single view on screen and divide it to
many regions to identify touch areas with different effects. I use your lib
as kid mode. So maybe they can play with it for long time.
If you have any ideas for this problem, could you please let me know.
Thank you again for all your help.
On Feb 19, 2016 6:30 AM, "Raul Portales" [email protected] wrote:
—
Reply to this email directly or view it on GitHub
#38 (comment).
from leonids.
The position is calculated based on the parent view, setting the position was a later addition for special cases like the follow touch example.
It should be possible to create a particle system during onCreate, as long as it is done after setContentView.
You can change the position anytime using the same method and then call oneShot. If it does not, that is a bug that should be solved (I haven't tried that particular case myself).
In this case, each time the user clicks, the oneShot will move, so if it is clicked before the previous one finishes there could be a visual glitch.
I suggest you create a pool of ParticleSystems and dynamically change the position and call oneShot, adding a listener when the oneShot is completed to return the particle system to the pool.
Given that each ParticleSystem creates a View to draw with, a small number should be easy to manage (that is also the cause of the unresponsiveness on your case)
The other solution is to create a method that finalizes the oneShot by removing the particle system from the view hierarchy.
The first solution (pool) is probably easier.
from leonids.
Thank you very much for your help, it works well now. I already handled
memory issue.
2016-02-22 17:46 GMT+07:00 Raul Portales [email protected]:
The position is calculated based on the parent view, setting the position
was a later addition for special cases like the follow touch example.It should be possible to create a particle system during onCreate, as long
as it is done after setContentView.You can change the position anytime using the same method and then call
oneShot. If it does not, that is a bug that should be solved (I haven't
tried that particular case myself).In this case, each time the user clicks, the oneShot will move, so if it
is clicked before the previous one finishes there could be a visual glitch.I suggest you create a pool of ParticleSystems and dynamically change the
position and call oneShot, adding a listener when the oneShot is completed
to return the particle system to the pool.Given that each ParticleSystem creates a View to draw with, a small number
should be easy to manage (that is also the cause of the unresponsiveness on
your case)The other solution is to create a method that finalizes the oneShot by
removing the particle system from the view hierarchy.The first solution (pool) is probably easier.
—
Reply to this email directly or view it on GitHub
#38 (comment).
from leonids.
Good to know, I hope this thread is useful for someone else in your situation.
from leonids.
Related Issues (20)
- 为什么用不了呀
- EmiterWithGravityExampleActivity ,How to make particles fly upward? HOT 1
- How to change TIMER_TASK_INTERVAL? HOT 2
- OneShot method doesn't call onDraw(); HOT 2
- Particle slowdown (air resistance)
- Copyright statement missing
- How to change the direction of the animation
- Use Leonids as a shared transition view HOT 1
- Emitters freeze after several seconds when built from latest tools HOT 3
- Particle Wall HOT 1
- Reverse Animation
- Rootview elevation HOT 2
- Bug causing crash
- Bug causing crash HOT 3
- JCenter shutdown HOT 5
- Top !!
- Typo in ParticleSystem class HOT 1
- Crash detected in onUpdate(long miliseconds) function
- Project Build error HOT 2
- NPE HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leonids.