폴 아이리쉬에는 requestAnimationFrame for Smart Animating이라는 게시물이 있습니다. 이제 Paul은 현명한 사람입니다. 저는이 아이디어의 적용 범위를 이해하려고 노력하고 있습니다.Paul Irish 님의 requestAnimationFrame shim을 사용하는 브라우저는 무엇입니까?
그는 HTML5 애니메이션을 말한다 -이 같은 requestAnimationFrame 심 사용해야 이해할 수
// shim layer with setTimeout fallback
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function(callback){
window.setTimeout(callback, 1000/60);
};
})();
// usage:
// instead of setInterval(render, 16) ....
(function animloop(){
requestAnimFrame(animloop);
render();
})();
// place the rAF *before* the render() to assure as close to
// 60fps with the setTimeout fallback.
합니다. We can apply this in a JSFiddle like this이며 결과가 매우 좋습니다.
하지만 if I rip out the shim layer function이면 Chrome 31 및 Firefox 24에서는 정상적으로 작동합니다.
그래서 compatibility for the RequestAnimationFrame function을 보면 브라우저가 매우 오랫동안이 기능을 사용하고있는 것처럼 보입니다.
내 질문 - 우리는 어떤 브라우저에서 Paul Irish의 요청을 사용하고 있습니까? AnimimationFrame shim? 당신은 그것을 추출 할 수 있고 여전히 작동하며, 브라우저가 오랫동안 그것을 가지고있는 것처럼 보입니다.
방금 연결 한 목록의 내용과 정확히 일치합니다. 특히 IE9의 경우. – SLaks
제시된 심을 사용하지 마십시오. 1000/60 실행을 지연시킵니다. raf의 유일한 목적은 과도한 DOM 업데이트를 피하는 것입니다. 다음 프레임 실행을 위해 콜백을 예약하는 실제 raf 폴리필을 더 잘 사용하십시오. –