Forums

OverviewFelgo 2 Support (Qt 5) › action after concurrent animations

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #18345

    Witold Walkiewicz

    Hi! I’m playing (in parallel) multiple animations (each in separated object inheriting EntityBase). I would like to perform some action after all that animations stops. Is there any clever way to do that? I can run a timer with estimated time of longest animation, but it looks like ugly hack to me.

    #18346

    Marcin

    Hi Witold,

    I don’t know any clever way when you can incorporate some Qt magic to do it, can propose something less sophisticated.
    I would suggest to have an object which holds state of every animation and listens to all animation stop signals, or each animation onStopped listener logic can inform that object instead.
    That object would have some bool properties, every time it receives an “info” from animation, that it stopped, it can check if all it’s bool properties are true.
    I assume properties can be like firstAnimatinoStopped: false; secondANimationStopped: false) etc.
    Once, at last, last animation in the order fires “stopped” signal, last object property goes to true what means all animations have stopped.

    There are variations how you can do it from technical point of view, which side sends custom signals or execute which function.
    If you have limited amount of animations just having bool property for each can be enough.
    If it’s more dynamic nature the listener object can have an array of animation states which can be dynamically changed(registered), etc.

    I am not sure how many objects/animations are involved etc so solution depends on your case.

    #18357

    Witold Walkiewicz

    Thanks, Marcin! That’s quite a good idea.

    I think that this way it will be easier just to use simple integer counter… if we know how to ensure atomic operations on it.

    W.

    #18358

    Marcin

    Yes, counter will work just fine as well.

Viewing 4 posts - 1 through 4 (of 4 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support