[英]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.