Animated HTML Canvas background suddenly not working in Chrome

So for my personal website, I created an animated background using JavaScript and HTML Canvas. It worked fine on Firefox, Chrome, Safari, etc. but I recently went to check on it and suddenly the animation isn't working in Chrome. It actually works in Chrome for mobile, but it doesn't work in Chrome desktop, which makes me think they must have changed something.

To set the background, I use the following code:

            <div class="info" style="background:-webkit-canvas(background) repeat;">
            <div class="info-1" style="background:-moz-element(#background) repeat;">

(It's been a while since I wrote it, but I think I included both to make it work in Chrome, Safari, and Firefox).

And, in terms of the script, I believe this is the relevant part:

window.requestAnimFrame = (function (callback) {
      return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) {
          window.setTimeout(callback, 1000 / 30);
      };
  })();

Does anyone have any thoughts as to why this might have stopped working within the last ~3 months?

链接地址: http://www.djcxy.com/p/23042.html

上一篇: GIF不能在Safari中使用表单提交,但可在Chrome中使用

下一篇: 动画HTML画布背景在Chrome中突然不起作用