为什么歌剧动画这么慢?

发布于 2024-12-05 07:37:49 字数 2122 浏览 3 评论 0原文

似乎 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文