PDA

View Full Version : Animating many objects with the Qt Animation Framework



pherthyl
22nd March 2010, 17:31
Hi everyone,

I have an app where the transition from one state to the next is animated. In this case, the box that is clicked animates its size larger, and all the other boxes on the screen fade out until they are hidden.

Now, back before state machines and animation frameworks in Qt, I read Aaron Seigo's post on performance in these cases (http://aseigo.blogspot.com/2008/02/animating-lots-of-things-simultaneously.html) and thus I have only one QTimeline to manage the whole transition, and each box does whatever it needs to do in onAnimationValueChanged.

This works well. However now I'm wanting to take advantage of the simplicity of the animation framework and toss my homegrown solution.

The easiest way would be for each box to have its own QPropertyAnimation and just handle animating itself. However, would all the performance problems that Aaron writes about still apply to the animation framework? Does it do anything internally to combine timer events and improve performance, or do I have to create a QParallelAnimationGroup and add all the box animations to that to realize the same performance improvements?

Thanks

pherthyl
24th March 2010, 17:45
Well I implemented it with QtPropertyAnimattions in each item, and performance doesn't seem to be any worse so I guess that answers my question.