简体   繁体   English

当浏览器下载所需的文件时,GIF在启动屏幕中动画缓慢

[英]GIF animates slowly in splash screen while browser downloads needed files

I have a SPA (Angular 1.4.8). 我有一个SPA(角度1.4.8)。 On start up, the client has to download many files while also performing authentication and bootstrapping. 在启动时,客户端必须下载许多文件,同时还要执行身份验证和引导。

Therefore I have a splash screen, which contains a simple GIF and few text lines that are updated according to the current loading stage. 因此,我有一个初始屏幕,其中包含一个简单的GIF和一些根据当前加载阶段更新的文本行。

I've noticed that the GIF smoothness depends on the browser/computer you open the page in. On a very fast computer, the GIF's animation runs as smooth as my eye can notice, while on other computers, slower ones, the animation is chunky (low FPS). 我注意到GIF的平滑度取决于您在其中打开页面的浏览器/计算机。在一台非常快的计算机上,GIF的动画运行得像我的眼睛所看到的那样平滑,而在其他计算机上,GIF的动画则较慢,该动画显得矮胖(低FPS)。

I'm assuming that this has to do with the load on the browser that has to do many things when loading my application, causing low FPS on the GIF's animation. 我假设这与浏览器的加载有关,浏览器的加载在加载我的应用程序时必须做很多事情,从而导致GIF动画的FPS较低。 This is just an assumption, according to my tests. 根据我的测试,这只是一个假设。

What can I do in order to ensure that the browser sacrifice all the required resources for playing the GIF right? 为了确保浏览器牺牲所有正确播放GIF所需的资源,我该怎么做?

Thanks 谢谢

Do not use gif. 不要使用gif。 Use CSS animated spinner like these . 使用像这样的 CSS动画微调器。 CSS animated spinners like these are not affected by the jam on main thread of the browser which executes your JS and updates the UI. 这样的CSS动画微调器不受执行您的JS并更新UI的浏览器主线程的阻塞的影响。

However, there is currently a bug on Blink that does cause the CSS animated spinner to pause with the jam on main thread. 但是,当前Blink上存在一个错误,该错误确实导致CSS动画微调器因主线程上的卡纸而暂停。

Google Chrome compositor-driven animation affected by jam in main thread 受主线程卡纸影响的Google Chrome合成器驱动的动画

But that should be fixed soon. 但这应该尽快解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM