简体   繁体   English

如何将两个动画同时应用于同一元素?

[英]How to apply two animations to the same element simultaneously?

I'm trying to apply two animations with different easings simultaneously to the same element but I can't get it to work. 我正在尝试将具有不同缓动效果的两个动画同时应用于同一元素,但无法使其正常工作。 This is what I tried: 这是我尝试的:

    $(window).load(function() {

        var speed = 1500;
        var delay = 0;

        for(var i = 0 + 1; i <= $('.skills li').length; i++) {

            var li = $('.skills li:nth-child(' + (i + 1) + ')');

            li.delay(delay).animate({
                left: "0"
            },{ 
                duration: speed, 
                queue: false,
                easing: 'easeOutBounce'
            });
            li.delay(delay).animate({
                opacity: 1
            },{
                duration: speed, 
                queue: false,
                easing: 'easeOut'
            });

            delay += 150;
        };
    });

Thanks in advance! 提前致谢!

You can add more than one property change parameter into animation object. 您可以在动画对象中添加多个属性更改参数。

for (var i = 0; i <= $('.skills li').length; i++) {

    var li = $('.skills li:nth-child(' + (i + 1) + ')');
    li.stop(true, true).delay(i * 150).animate({
        left: "0", 
        opacity: 1
    }, {
        duration: speed,
        queue: true, //do you want one-by-one or all together , please specify?
        specialEasing: {
          width: "linear",
          height: "easeOutBounce"
        }
    });

};

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将两个不同的动画应用到具有不同持续时间的同一元素上? - How to apply two different animations to the same element with different duration? 如何同时在单个元素上运行两个jQuery动画 - How to run two jQuery animations on a single element simultaneously 如何同时运行两个 jQuery 动画? - How to run two jQuery animations simultaneously? 如何在每次迭代中错开动画并同时触发两个动画 - How to stagger animations and trigger two animations simultaneously on each iteration 在PowerPoint中,有两个动画称为“褪色缩放”和“反弹”。 如何将相同的动画应用于我网站上的图像? - In PowerPoint, there are two animations called “faded zoom” and “bounce”. How can I apply those same animations to images on my website? 同时结束两个jquery动画 - end two jquery animations simultaneously 如何使用animated.css一次在两个元素上应用动画 - How to apply animations on two elements at once with animated.css jQuery:如何同时进行连续动画和同时动画 - Jquery: How to do both successive and simultaneously animations 如何强制jQuery动画同时运行? - How to force jQuery animations to run simultaneously? 如何通过单击获得多个动画,然后通过第二次单击交替动画在同一元素上获得多个不同的动画? - How do I get multiple animations with a click, and then multiple different animations on the same element with a 2nd click alternating the animations?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM