如何保持gif动画一边跑一边做激烈的计算 [英] How to keep animated gif running while doing intense calculations

查看:200
本文介绍了如何保持gif动画一边跑一边做激烈的计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,其中javascript中一些激烈和持久的计算。我想有一个加载动画,告诉正在取得用户的进展。我现在有一个GIF动画,但整个浏览器窗口冻结(与GIF不玩),而JavaScript的运行。然后,当它完成,它解冻。计算必须是客户端,这样他们可以不是服务器上完成。

I have a page which does some intense and long lasting calculations in Javascript. I would like to have a loading animation to tell the user progress is being made. I have an animated gif now, but the whole browser window freezes (and the gif does not play) while the Javascript is running. Then when it's done, it unfreezes. The calculations must be client-side so they cannot be done on a server.

有没有一种方法来保持的Javascript冻结页面,而从它做计算停止播放动画?

Is there a way to keep Javascript from freezing the page and stopping animations from playing while it's doing calculations?

推荐答案

您也可以使用HTML5 webworkers 维基百科)运行在后台长时间运行脚本。它就像多线程JavaScript的。

You can also use HTML5 webworkers (Wikipedia) to run long running scripts in the background. It is just like multi threading for javascript.

这将工作,最新的浏览器IE除外。

It will work in latest browsers except IE.

使用发现游戏webworkers 检查出来

Found a game using webworkers check it out

这篇关于如何保持gif动画一边跑一边做激烈的计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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