如何知道为什么动画口吃? [英] How to know why an animation stutters?

查看:192
本文介绍了如何知道为什么动画口吃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个非常简单的动画(走动文字,动椭圆等),并在全屏幕(1920×1080减去任务栏)中的WPF性能套件报告整个动漫周边50 FPS的好帧率运行。脏矩形加法是大约300 RECT / s的某处时,SW帧是0和4,并且HW帧之间是3和5的视频存储器使用率之间大约是80 MB。

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 good framerate around 50 FPS throughout the animation. Dirty Rect Addition is somewhere around 300 rect/s, the SW frames are between 0 and 4 and the HW frames are between 3 and 5. Video memory usage is around 80 MB.

问题是,动画口吃每隔半秒钟。这绝对不是液: - (

Problem is that the animations stutters every other half second. It is definitely not fluid :-(

我的机器是新的戴尔笔记本电脑用的GeForce GT 435 2GB内存XPS 15。 - 这些驱动程序是最新的。 (在我的上网本出现同样的情况(全屏),以及,所以我不认为这是硬件有关。)

My machine is a new Dell laptop XPS 15 with the GeForce GT 435 with 2GB memory. - The drivers are up to date. (The same behavior occurs on my netbook (in full screen) as well so I don't think it is hardware related.)

如果我使窗口越小口吃消失。

If I make the window smaller the stutter goes away.

该结巴用最简单的动画时 - 即使只是一对夫妇的元素,但加入了更多的元素肯定使得它更加引人注目

The stutter occurs with the simplest of animations - even with just a couple of elements but adding more elements certainly makes it more noticeable.

我如何找出是什么原因导致这种口吃?

当我想起来了,我还没有真正看到它在全屏流畅运行任何WPF动画。这甚至可能?

When I think of it, I have not actually seen any WPF animations which run smoothly in full screen. Is this even possible?

推荐答案

你有没有尝试设置较低的最大帧速率的动画?

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

<Storyboard Timeline.DesiredFrameRate="10">
    <!-- ....blah blah blah  -->
</Storyboard>

如果您的动画是造成子或父元素的大规模重新计算,改变的 DesiredFrameRate 将对由系统进行的计算的数目的级联效应。
此外,检查出的这种备注部分<一个href=\"http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k%28SYSTEM.WINDOWS.MEDIA.ANIMATION.TIMELINE.DESIREDFRAMERATE%29%3bk%28VS.XAMLEDITOR%29%3bk%28TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV4.0%22%29&rd=true\"相对=nofollow>链接。它解释了为什么/时,你应该使用它。

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.

如果设定一个较低的帧速率修复您的口吃,那么你需要考虑简化您的XAML来限制在动画的每一帧需要重新计算的金额(限制大小子女或父母对象的数量 - 或受到任何影响 - 由动画由每帧/所做的更改

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.

您可能还需要检查出 WPF性能套件 。这是一个真棒的工具集,以确定究竟是什么在你的WPF应用程序怎么回事,看到这正在重绘的窗口部件时,和每个XAML元素的CPU使用率!

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!

希望这有助于!

这篇关于如何知道为什么动画口吃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆