Farr far away....

gary farr's blog
in

Better XAML By Farr: Animation Frame Rates per second

A quick helper when dealing with WPF animations and CPU usage.  By default, WPF animation frame rates run at 60 frames per second.  However, the eye cannot tell the difference from anything above 30 frames per second.  Obviously, more frames per second result in higher CPU utilization.  For many animations running at 60 frames per second is overkill.  However there is a way to change this value.  By adding the line below at the start of your application, you will set the default frames per second for any animation to your desired value.  In the case below, 30 frames per second.

   1: Timeline.DesiredFrameRateProperty.OverrideMetadata
   2: (typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 30 });

After this is set, all animations will run at 30 frames per second thereby decreasing your CPU utilization and improving your overall applications performance. 

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required)