动画:定时器VS闲置 [英] Animation: Timer vs Idle

查看:131
本文介绍了动画:定时器VS闲置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个类似线程其他地方,但它fo​​cues上gameprogramming我找到普通GUI应用程序有点不同了一些多余的糖分。

There is a similar thread else where, but it focues on gameprogramming which I find a little different to regular gui applications with some 'extra sugar'.

什么是正确的做法,用于驱动小型的GUI的动画(如展开/折叠面板,发光按钮等)?

What would be the right approach for driving small gui-animations (like expanding/collapsing panels, glowing buttons etc)?

难道是最好设置消防定期计时器或会更好使用空闲事件?

Would it be best to setup a timer to fire at regular intervals, or would it be better to use the idle-event?

如何WPF推动其动画?

How does WPF drive its animations?

我知道有什么上最好的摆在那里,所以让我们将它们收集齐全了很多意见: - )

I know there are a lot of opinions on whats best out there, so lets collect them all :-)

更新:好的。我觉得这个出来有点不清楚。我没有使用WPF,我不感兴趣,你如何触发WPF动画。我什么之后,是关于为什么时间那么使用ONIDLE事件驱动动画更好或更坏的讨论。不启动它,驾驶它。

UPDATE: Ok. I think this came out a little unclear. I'm not using WPF, and I'm not interested in how you trigger an animation in WPF. What I'm after, is a discussion about why a time is better or worse then using an onidle event to drive the animation. Not start it, drive it.

推荐答案

您如何开车动画应基于您的处理优先级。

How you drive your animation should be based on your processing priorities.

如果您使用的定时器,你会得到更多的一贯要求。这可以让你在同行业竞争的处理能力,更重要的进程。通过驾驶的OnIdle允许其他进程负责,但它也意味着动画可以得到饿死了。

If you use a timer, you will get called more consistently. This can put you in competition with more important processes for processing power. Driving by OnIdle allows other processes to take charge, but it also means that the animation could get starved.

正确选择取决于你的具体的优先事项。

The correct choice depends your specific priorities.

我不知道WPF如何处理这一点,但要立足于绝对的开始时间的动画,而不是递增的每个呼叫的动画,因为动画可能不会定期叫那将是非常重要的。

I'm not sure how WPF handles this, but it would be important to base the animation on the absolute start time rather than incrementing the animation on each call because the animation may not get called at regular intervals.

这篇关于动画:定时器VS闲置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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