控制Jquery路径贝塞尔速度



我有一个动画,它在<div id="robert">stuff</div>中淡出,然后让它遵循下面指定的路径。我想知道是否有办法可以减慢贝塞尔曲线动画部分的速度?我把它设置为"摇摆"的放松,但有没有一种工作来减缓它?

var pathRobert = {
    start: {
        x: 408,
        y: 303,
        angle: 72.594,
        length: 1.390
    },
    end: {
        x: 510,
        y:375,
        angle: 233.366,
        length: 1.138
    }
};
$(window).scroll(function(){
    //first animation for ipad with hands
    if ((withinViewport((testimonials)) == true) && (peopleBlock !=0)){
        peopleBlock = 0;
        $("#robert").fadeTo('fast',1).animate({
            path : new $.path.bezier(pathRobert)
        },"swing");  
    }
});

谢谢,亚历克斯

您应该能够指定持续时间和缓动。

.animate( properties [, duration ] [, easing ] [, complete ] )

类似:

$("#robert").fadeTo('fast',1).animate({
    path : new $.path.bezier(pathRobert)
},5000,"swing");
http://jsfiddle.net/kLRN2/

相当简单的修复:

  $("#rita").fadeTo('fast',1).animate({
            path : new $.path.bezier(pathRita)
        },800);

只需将"swing"替换为您想要的时间…

最新更新