How to make the animation smoother through code in WPF?

前端 未结 3 352
你的背包
你的背包 2020-12-16 17:27

How do we do the smooth animation. I have the code as below.

ThicknessAnimation anima = 
    new ThicknessAnimation(new Thickness(0), new Thickness(0, 25, 0,         


        
3条回答
  •  离开以前
    2020-12-16 18:26

    To do this in code, you would use the Timeline.SetDesiredFrameRate(Timeline,int?) method, like this:

    ThicknessAnimation anim = ...;
    Timeline.SetDesiredFrameRate(anim, 60); // 60 FPS
    

    Passing null for the second argument tells the system to control the frame rate.

提交回复
热议问题