How to know why an animation stutters?

后端 未结 3 1901
醉话见心
醉话见心 2021-02-14 02:16

I have a few fairly simple animations (moving text around, moving ellipses etc.) and running in full screen (1920x1080 minus the task bar) the WPF Performance Suite reports a go

3条回答
  •  借酒劲吻你
    2021-02-14 03:08

    Have you tried to set a lower "max frame rate" to the animation?

    
        
    
    

    If your animation is causing massive recalculation of child or parent elements, changing the DesiredFrameRate will have a cascading effect on the number of calculations made by the system. Also, check out the "Remarks" section of this link. It explains why/when you should use it.

    If setting a lower frame rate fixes your stuttering, then you need to consider simplifying your XAML to limit the amount of recalculation needed at every frame of your animation (limiting the number of child or parent objects resized - or affected in any way - by every frames/changes made by the animation.

    You might want to also check out the "WPF Performance Suite". It is an awesome set of tools to determine what exactly is going on in your WPF app, seeing which parts of your window are being repainted and when, and the CPU usage of each of your XAML elements!

    Hope this helps!

提交回复
热议问题