为什么歌剧动画这么慢?
似乎 Opera 在同时进行多个动画时效果不佳,请查看 这个主题 我正在建设。我制作了一个预加载器,它将图像分散在身体外部的随机位置,然后以 0.1 秒的间隔将每个图像动画到位,动画需要 0.8 秒。
这是我制作的功能:
function ea_preload_scatter() {
if(item.length) {
var scatter = $(window).height() + $(window).width();
item.addClass('loading').each(function() {
var positionX = ['','-'],
positionY = ['','-'],
x = Math.floor(Math.random()*2),
y = Math.floor(Math.random()*2);
if(positionX[x] === '-') {
posX = -scatter;
} else {
posX = scatter;
}
if(positionY[y] === '-') {
posY = -scatter;
} else {
posY = scatter;
}
$('img', this).addClass('absolute').css('top',posX).css('left',posY);
});
$(window).load(function() {
var i = 0,
speed = 800;
function ea_scatter_animate(e) {
$('img',item.eq(e)).css({
zIndex: '10000'+e
}).stop().animate({
top:0,
left:0
}, speed, 'easeInOutExpo', function() {
$(this)
.removeClass('absolute')
.removeAttr('style')
.parent()
.removeClass('loading');
});
var t = setTimeout(function() {
if(e == item.length) {
clearTimeout(t);
} else {
ea_scatter_animate(i++);
}
}, 100);
}
ea_scatter_animate(i);
});
}
}
Opera:
Version
11.51
Build
1087
Mac:
Platform
Mac OS X
System
10.6.8
Processor
2.93 GHz Intel Core i7
Memory
8GB 1333 MHz DDR3
那么我可以做些什么来让这个功能在 Opera 上很好地播放吗?或者歌剧就是歌剧?
It seems as though opera doesn't play nice with multiple animations going on simultaneously, check out this theme I'm building. I've made a preloader which scatters the images outside body in random places then animates each of them into place in intervals of 0.1 seconds with the animation taking 0.8 seconds.
Here's the function I made:
function ea_preload_scatter() {
if(item.length) {
var scatter = $(window).height() + $(window).width();
item.addClass('loading').each(function() {
var positionX = ['','-'],
positionY = ['','-'],
x = Math.floor(Math.random()*2),
y = Math.floor(Math.random()*2);
if(positionX[x] === '-') {
posX = -scatter;
} else {
posX = scatter;
}
if(positionY[y] === '-') {
posY = -scatter;
} else {
posY = scatter;
}
$('img', this).addClass('absolute').css('top',posX).css('left',posY);
});
$(window).load(function() {
var i = 0,
speed = 800;
function ea_scatter_animate(e) {
$('img',item.eq(e)).css({
zIndex: '10000'+e
}).stop().animate({
top:0,
left:0
}, speed, 'easeInOutExpo', function() {
$(this)
.removeClass('absolute')
.removeAttr('style')
.parent()
.removeClass('loading');
});
var t = setTimeout(function() {
if(e == item.length) {
clearTimeout(t);
} else {
ea_scatter_animate(i++);
}
}, 100);
}
ea_scatter_animate(i);
});
}
}
Opera:
Version
11.51
Build
1087
Mac:
Platform
Mac OS X
System
10.6.8
Processor
2.93 GHz Intel Core i7
Memory
8GB 1333 MHz DDR3
So is there anything I can do to make this play nicely with Opera? Or is it just Opera being Opera?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论