FF 中画布图像滚动性能
我在 FF 中遇到了严重的性能问题。
这是代码:
JS:
var img = new Image();
img.src = 'image.jpg';
var w = $(window).outerWidth();
var h = $(window).height();
var addit = -1;
var scrollSpeed = 10; //fast in IE, but very slow in FF
var current = 0;
ctx = document.getElementById('canvas1').getContext('2d');
var init = setInterval(function(){
current += addit;
ctx.drawImage(img,current,0, w, h);
}, scrollSpeed);
CSS:
#canvas1 {
width:auto;
height:100%;
position: absolute;
top: 0;
left: 0;
}
body {
overflow: hidden;
}
HTML:
<body>
<canvas id="canvas1" width="1784px" height="534px"></canvas>
</body>
image.jpg is 1784x534px
任何人都可以帮我得到FF 和 IE 的性能一样吗? 我尝试过使用 CSS left 属性,但性能仍然很慢。 谢谢你!
I am having a terrible performance issue in FF.
Here is the code:
JS:
var img = new Image();
img.src = 'image.jpg';
var w = $(window).outerWidth();
var h = $(window).height();
var addit = -1;
var scrollSpeed = 10; //fast in IE, but very slow in FF
var current = 0;
ctx = document.getElementById('canvas1').getContext('2d');
var init = setInterval(function(){
current += addit;
ctx.drawImage(img,current,0, w, h);
}, scrollSpeed);
CSS:
#canvas1 {
width:auto;
height:100%;
position: absolute;
top: 0;
left: 0;
}
body {
overflow: hidden;
}
HTML:
<body>
<canvas id="canvas1" width="1784px" height="534px"></canvas>
</body>
image.jpg is 1784x534px
Can anybody help me get the same performance in FF as IE?
I have tried to use CSS left property but performance is still slow.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过对硬件加速的一些调查后;我注意到 Firefox“about:support”中“Direct2D Enabled”被错误版本的图形驱动程序阻止。
我更新了它,现在由于硬件加速,速度变得更快了。
after some investigation into hardware acceleration; I noticed in Firefox "about:support" that "Direct2D Enabled" was blocked by a wrong version graphics driver.
I updated it, and now things are much faster thanks to hardware acceleration.