简体   繁体   English

当我在其他选项卡中时,为什么动画会缓慢停止?

[英]Why does the animations slowly stops when I am in a different tab?

Why does the animations slowly stops when I am in a different tab or when window is minimized? 当我在其他选项卡中或最小化窗口时,为什么动画会缓慢停止?

It's this codepen link - http://codepen.io/heyjules/pen/LVoEOw 正是这种codepen链接- http://codepen.io/heyjules/pen/LVoEOw

It works fine at first. 起初它工作正常。 But then once you tab out or minimize (for about 5- 10 sec), The "particles" have lessened. 但是,一旦您取消选择或最小化(大约5到10秒),“粒子”就会减少。

Why does it do this? 为什么这样做呢? How do I stop this from happening? 如何阻止这种情况的发生?

<html>
<head>
    <meta charset="utf-8">
    <title>Particles</title>
    <style type="text/css">
        html,body {
            margin: 0;
            padding: 0;
            overflow: hidden;
            width: 100%;
            height: 100%;
        }
        #canvas {
            cursor: none;
        }
    </style>
</head>
<body>
    <canvas id="canvas"></canvas>
    <script type = "text/javascript" src="particles.js"></script>
</body>

In modern browsers the timers (setTimeout, setInterval, setImmediate and requestAnimationFrame) are set to not fire more often than once per second in inactive tabs. 在现代浏览器中,计时器(setTimeout,setInterval,setImmediate和requestAnimationFrame)设置为在不活动的选项卡中触发频率不超过每秒一次。

https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout#Inactive_tabs https://developer.mozilla.org/zh-CN/docs/Web/API/WindowTimers/setTimeout#Inactive_tabs

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

相关问题 为什么当我使用 addEventListener 时复选框停止工作 - why does checkbox stops working when ever i use addEventListener 为什么我在浏览器控制台和“网络”选项卡中得到两种不同的响应 - Why I am getting two different response in browsser console and network tab 为什么当我关闭选项卡时 onload() 不起作用? - why does not onload() work when i close the tab? 为什么当我使用“隐藏”时我的按钮反应缓慢? - Why my buttons are reacting slowly when I use "hidden"? 为什么我登录时登录页面加载缓慢 - Why my log in page load slowly when i login 为什么我在使用制表键和箭头键时无法专注于此菜单项? - Why am I not able to focus on this menu item when using tab and arrow keys? 在其他选项卡中建立JQueryUI动画 - JQueryUI animations building up while in a different tab 为什么Chrome渲染JavaScript的速度如此之慢? - Why does Chrome render JavaScript so slowly? 为什么我在本地和在 heroku 时从我的数据中得到不同的响应? - Why am I getting different response from my data when local and when on heroku? 为什么除了简单的滑入效果之外,我无法让任何 textillate.js 动画工作? - Why am I unable to get any of the textillate.js animations to work except for the simple slide-in effect?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM