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

Awesome library, but need help with "circles emitter" :-P #34

Open
mbt-administrator opened this issue Dec 3, 2015 · 2 comments
Open

Comments

@mbt-administrator
Copy link

Well, I have to admit, this is awesome work. Easy to use implementation, documented source code. What more could we ask ? Well, there is always more ... ^^

Let's get straight to the point.

I have to draw an empty circle, which means we can only see the border (the membrane) of the circle and that's it.

This is the XML content that draws a circle :

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadius="0dp"
    android:shape="ring"
    android:thicknessRatio="5"
    android:useLevel="false" >
    <solid android:color="@android:color/transparent" />

    <stroke
        android:width="2dp"
        android:color="@color/yellow" />
</shape>

So now I can add in a XML View's background and there I have my circle.

What I am looking for is that the yellow membrane/border of this circle is supposed to emit the particles and have these particles being drawn to the center of the circle. Unfortunately, I don't have sample to provide to show what I am looking for.

So to be simple and precise, the particles are generated all around the circle, from the inner-side of the border (so not from outside !). These particles must move very very slowly and must be drawn to the center of the circle. Moreoever, the fastest particles are supposed to die before reaching the center.

I hope I am clear enough.

If I try to have a ParticleSystem emit on the circle's View, it will emit particles both inside and outside the circle, because the View containing the circle is a square. So the X&Y coordinates do not match the circle's...

Is there a way to accomplish this ?

Thanks !

@plattysoft
Copy link
Owner

Interesting, this is not currently supported, but you could make fork and tweak the library to add an initializer that takes a radius and spawns particles around that with a random angle.

The second part it to get attracted by the center. That should be a modifier or maybe an initializer where the acceleration depends on the angle.

Tricky, and not supported directly, but doable.

@mbt-administrator
Copy link
Author

I found a way by creating multiple emitters around the circle, but performance is bad as there are too many emitters and too many particles.

Thanks for the idea 👍

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