javascript使用

    技术2022-07-11  124

    javascript使用

    The requestAnimationFrame function has been a major boost to developers creating and managing animations with JavaScript.  Paul Irish has an excellent introduction on requestAnimationFrame -- I highly recommend you read it.  This HTML5Hub post is also very good.  Most browsers now support the animation function but in the case a browser doesn't, you can shim a rough equivalent with setInterval:

    requestAnimationFrame函数极大地促进了开发人员使用JavaScript创建和管理动画。 保罗·爱尔兰(Paul Irish)对requestAnimationFrame了出色的介绍 -我强烈建议您阅读它。 此HTML5Hub帖子也非常好。 现在,大多数浏览器都支持动画功能,但是如果不支持动画功能,则可以使用setInterval大致等效:

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

    requestAnimationFrame was implemented with browser prefixes so we'll check for those if the unprefixed window method isn't there.  If no native implementation exists, a setInterval shim will have to do!

    requestAnimationFrame是使用浏览器前缀实现的,因此我们将检查是否存在不带前缀的window方法。 如果不存在本机实现,则必须执行setInterval填充程序!

    翻译自: https://davidwalsh.name/requestanimationframe-shim

    javascript使用

    相关资源:jdk-8u281-windows-x64.exe
    Processed: 0.008, SQL: 9