![]() |
[Qt] Animation - Big CPU consumption
Please look at this code:
Code:
QPropertyAnimation *animation = new QPropertyAnimation(item, "pos"); |
Re: [Qt] Animation - Big CPU consumption
Are you sure about the 200ms ? That's like 5 steps in a second. IIRC The default should be around 40-50ms (so you get 25+ fps).
|
Re: [Qt] Animation - Big CPU consumption
Yes I am sure. It is in QTimer and I start it as timer->start(200);
|
Re: [Qt] Animation - Big CPU consumption
So, every 200ms you're creating a new animation that runs for 300ms?
|
Re: [Qt] Animation - Big CPU consumption
If I understood that function correctly you are moving some item 20 pixels down 5 times a second. Or do you use it to move different items?
Anyway it looks like you are creating a new QPropertyAnimation object 5 times a second. You could create the object elsewhere (e.g. as a class member) and use it's pointer in the function. On a side note, the animation duration is longer than the interval of the function calls. Hard to give any other comments without more details about the purpose of the function and you application. |
Re: [Qt] Animation - Big CPU consumption
Sry bad example time is changeable. Duration is 199ms.
|
Re: [Qt] Animation - Big CPU consumption
You don't need a QTimer to do an infinite loop for QPropertyAnimation.
Just create the animation once and set Code:
animation->setLoopCount(-1); |
Re: [Qt] Animation - Big CPU consumption
thx, i have timer because i need timer for other action. ok i will try it when i will come to home. i am not sure if it will work because i need to change parameters of animation
|
Re: [Qt] Animation - Big CPU consumption
I try it and It isnt good. ANimation is created one. And cpu consumption is 70-80%.
|
Re: [Qt] Animation - Big CPU consumption
Have you got an OpenGL ES renderer. (not even sure thats allowed)
|
| All times are GMT. The time now is 18:08. |
vBulletin® Version 3.8.8