在动画结束前获得10秒 [英] get 10 sec before animation ends
本文介绍了在动画结束前获得10秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨。
我有很多长动画在一起运行,我需要在动画结束前10秒做一些事情。
我想为每个人制作一个看不见的动画,并行运行并在10秒之前设置持续时间。
但是我的归档并不是最好的方式。
有什么想法吗?
谢谢。
Hi.
I have many long animations running together and i need to do something 10 sec before the animations ends.
i thought create an invisible animation for each one, that run in parallel and set the duration 10 sec before.
But i have the filing its not the best way.
Some idea?
thanks.
推荐答案
你可以使用Timer Class [ ^ ]
参见这个小例子。
You could use the Timer Class[^]
See this little example.
private void SomeMethod()
{
// Set this variable to the animation duration
TimeSpan aniTime = new TimeSpan(0, 0, 25);
System.Timers.Timer timee = new System.Timers.Timer();
// This will make the timer to fire the event only once
timee.AutoReset = false;
timee.Elapsed += Timee_Elapsed;
// The Timer.Interval is in milliseconds
timee.Interval = aniTime.TotalMilliseconds - 10000;
timee.Start();
}
private void Timee_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
// Do what ever you need to do here
}
这篇关于在动画结束前获得10秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文