//主要是区分浏览器的不同,如果浏览器不支持requestNextAnimationFrame()方法,只能使用setTimeout()来代替。这种封装方式称为polyfill method,多平台智能适配方法,主要思想是利用不同平台的优缺点,当不满足时再用替代方法;个合集思想,而不是交集思想。
window.requestNextAnimationFrame =
(function () {
var originalWebkitRequestAnimationFrame = undefined,
wrapper = undefined,
callback = undefined,
geckoVersion = 0,
userAgent = navigator.userAgent,
index = 0,
self = this;
// Workaround for Chrome 10 bug where Chrome
// does not pass the time to the animation function
if (window.webkitRequestAnimationFrame) {
// Define the wrapper
wrapper = function (time) {
if (time === undefined) {//chrome10版本的BUG,现在应该已经修复了,此值一直是undefined
time = +new Date();
}
self.callback(time);
};
// Make the switch
originalWebkitRequestAnimationFrame = window.webkitRequestAnimationFrame;
window.webkitRequestAnimationFrame = function (callback, element) {
self.callback = callback;
// Browser calls the wrapper and wrapper calls the callback
originalWebkitRequestAnimationFrame(wrapper, element);
}
}
// Workaround for Gecko 2.0, which has a bug in
// mozRequestAnimationFrame() that restricts animations
// to 30-40 fps.
if (window.mozRequestAnimationFrame) {
// Check the Gecko version. Gecko is used by browsers
// other than Firefox. Gecko 2.0 corresponds to
// Firefox 4.0.
index = userAgent.indexOf('rv:');
if (userAgent.indexOf('Gecko') != -1) {
geckoVersion = userAgent.substr(index + 3, 3);
if (geckoVersion === '2.0') {
// Forces the return statement to fall through
// to the setTimeout() function.
window.mozRequestAnimationFrame = undefined;
}
}
}
return window.requestAnimationFrame ||//w3c对象
window.webkitRequestAnimationFrame ||//chrome对象
window.mozRequestAnimationFrame ||//firefox对象
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||//window对象
function (callback, element) {//为了解决firefox 4.0版本帧速率过慢的bug,在后续版本中已改正
var start,
finish;
window.setTimeout( function () {
start = +new Date();
callback(start);
finish = +new Date();
self.timeout = 1000 / 60 - (finish - start);
}, self.timeout);
};
}
)
();
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: 精选论文 | Capon算法与MUSIC算法性能的比较与分析
公众号【调皮连续波】,其他平台为自动同步,内容若不全或乱码,请前往公众号阅读。持续关注调皮哥,获得更多雷达干货学习资料和建议,和大家一起学习雷达技术。 【正文】 首先说结论: 当信噪比(SNR)足够大时,Capon算法和MUSIC算法的空间谱非常相似,因此在S…