WPF 动画持续时间 [英] WPF Animation Duration

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

问题描述

我有一个像下面这样的故事板

I have a storyboard like the following

Duration="0:0:1" Completed="DeviceExplorer_Completed">

Duration="0:0:1" Completed="DeviceExplorer_Completed">

由于某种原因,动画似乎不是线性工作的.如果我将持续时间更改为 Duration="0:0:0.8"

The animation for some reason does not appear to be working linearly. If I change the duration to something like Duration="0:0:0.8"

并将 stroyboard 分配给按钮的 MouseEnter 事件,动画移动但由于某种原因没有完成,我将鼠标移到按钮上几次,然后它最终完成...

and assign the stroyboard to a MouseEnter event of a button, the animation moves but does not complete for some reason, I move my mouse over the button a few times before it enetually completes...

知道为什么吗?

推荐答案

我在动态创建故事板和动画时遇到了类似的问题.帮助我的是确保在单个动画上设置持续时间.您可以尝试在屏幕上放置一个按钮并使用它来触发情节提要……在那里放置一个断点可以确保动画与情节提要具有相同的持续时间.

I had an issue with something like this when I was creating the storyboard and animations dynamically. What helped me was to ensure that the duration was set on the individual animations. You might try putting a button on your screen and using that to fire the storyboard... placing a breakpoint there would let you ensure that the animations had the same duration as the storyboard.

找到解决方法后,我没有时间完全调试问题,但我怀疑这与我创建故事板和动画的顺序有关.在我的情况下,故事板非常动态,因此调整一些额外对象的持续时间是我最不关心的.

After finding the workaround, I haven't had the time to fully debug the issue but I suspect it had to do with the order in which I am creating the storyboard and animations. In my situation, the storyboard is very dynamic so adjusting the duration on a few extra objects is the least of my concerns.

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

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