[Interest] Particles Emitter, emit signal when particle life is expired?

Mark markg85 at gmail.com
Thu May 16 15:50:02 CEST 2013


On Thu, May 16, 2013 at 9:37 AM, Sletta Gunnar <Gunnar.Sletta at digia.com> wrote:
>
> On May 14, 2013, at 9:58 AM, Mark <markg85 at gmail.com> wrote:
>
>> On Sun, May 12, 2013 at 2:08 PM, Mark <markg85 at gmail.com> wrote:
>>> Hi,
>>>
>>> I'm browsing through the Emitter API while searching for "some" way to
>>> get notified when a particle is expired.
>>>
>>> What i'm having is one emitter that emits 1 particle every 25ms then
>>> one trailemitter that adds a trail to the particle. Now in the main
>>> emitter (with 1 particle every 25 ms) i want to get notified when the
>>> particle dies - which is 625 ms later. How can i do that?
>>>
>>> I can probably play with the Timer element, but then i'd need a timer
>>> for every particle which is quite a pain to do in QML in a dynamic
>>> fashion.. I'm actually hoping there is a signal somewhere (or a
>>> onSomething...) that i haven't found yet but can also be used to get
>>> the same result.
>>>
>>> If that doesn't exists then i guess i need to make a dynamic timer
>>> element for QML, right?
>>>
>>> The ideal thing - for me - to have here is a signal that fires with
>>> the X and Y position where the particle expired.
>>>
>>> Regards,
>>> Mark
>>
>> Anyone?
>
> Tracking each individual particle is not really in line with the concept of a particle systems as they are typically set up as fire-and-forget to be as cheap and fast as possible.
>
> However, there might be way that works for you, granted that you don't have too many particles live at the same time.
>
> If you use the ItemParticle, you can specify a delegate for it. This delegate can be a normal Image {} item, and will be a lot slower (probably in the range 100-1000x worse) than plain a ImageParticle, but  you can then track it using the onVisibleChanged signal. When the item is visible, it is "alive" and when it is hidden its lifespan has ended.
>
> cheers,
> Gunnar
>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>

Hi Gunnar,

That sounds like a possible but painful solution..

I actually think i'm going for a different route: making my own custom
timer component from C++.
What i need is this:
1st particle gets emitted and dies 625ms later
2nd particle gets emitted which could be directly after the first one
as in 1 ms later or be one minute later. I simply don't know since
that's depending in the input. For the timer signals this matters. I
sadly can't easily use the Timer() component since that would mean one
separate Timer{} for every particle.

So i guess i have to make my own custom timer component.. If you have
another better idea that isn't as performance impacting as
ItemParticle, please do tell :)



More information about the Interest mailing list