使用线程进行动画制作 [英] Use threads for animation

查看:169
本文介绍了使用线程进行动画制作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在做一个弹跳球动画,并在线寻求线程帮助。

到目前为止我找到了这个。



线程线程=新线程(新的ThreadStart(moveBalls));



thread.start ();



while(!thread.isAlive);



Thread.sleep(1000);



这不起作用,我认为这是针对旧版本的.NET。我正在使用Visual Studio Express 2010,非常感谢任何帮助。



谢谢

Hi,

I am doing a bouncing balls animation and have looked online for help with threads.
So far I have found this.

Thread thread = new Thread(new ThreadStart(moveBalls));

thread.start();

while(!thread.isAlive);

Thread.sleep(1000);

This does not work, I think this is for an older version of .NET. I am using Visual Studio Express 2010 and any help would be greatly appreciated.

Thanks

推荐答案

尝试删除分号:

Try removing the semicolon:
while(!thread.isAlive);
                      ^


thread.start();

while(!thread.isAlive)
{
    Thread.sleep(1000);
}





更好的解决方案是使用重置事件。



A better solution would be to use reset events though.


这篇关于使用线程进行动画制作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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