Javascript 为jQuery中的几个元素平滑链接动画

Javascript 为jQuery中的几个元素平滑链接动画,javascript,jquery,css,animation,queue,Javascript,Jquery,Css,Animation,Queue,为了跨域的目的,我正在尝试通过使用jQuery连续地为几个堆叠的图像设置动画来重新创建地图的放大效果 到目前为止,我取得了一些成就,通过使用延迟和每个图像的两个单一动画(A&B日志)对动画进行排队,以便通过缩放和在下一个图像上淡入淡出来生成图像之间的平滑过渡 $('img:not(:last-child)') /* All images but farest zoom */ .reverse() /* From last to first */ .each(function (index) {

为了跨域的目的,我正在尝试通过使用jQuery连续地为几个堆叠的图像设置动画来重新创建地图的放大效果

到目前为止,我取得了一些成就,通过使用延迟和每个图像的两个单一动画(A&B日志)对动画进行排队,以便通过缩放和在下一个图像上淡入淡出来生成图像之间的平滑过渡

$('img:not(:last-child)') /* All images but farest zoom */
.reverse() /* From last to first */
.each(function (index) {
    $(this).css( /* From half size… */ {
        'width': 584,
        'height': 336,
        'margin-left': -292,
        'margin-top': -168
    });
    $(this).delay(index * 300).animate( /* …to actual size */ {
        'width': 1168,
        'height': 673,
        'margin-left': -584,
        'margin-top': -336
    }, {
        duration: 300,
        easing: 'linear',
        done: function () {
            console.log('A:', index, new Date().getTime() - timestamp);
        }
    });
});
$('img:not(:first-child)') /* All images but closest zoom */
.reverse() /* From last to first */
.each(function (index) {
    $(this).animate( /* Animate to double size */ {
        'width': 2336,
        'height': 1346,
        'margin-left': -1168,
        'margin-top': -673,
        'opacity': 0
    }, {
        duration: 300,
        easing: 'linear',
        done: function () {
            console.log('B:', index, new Date().getTime() - timestamp);
            $(this).remove(); /* Remove the elment once completed */
        }
    });
});
众所周知,jQuery缺乏对单个队列中不同DOM元素的队列动画的支持,这导致了这种复杂的解决方案

求你了

正如您将看到的,一旦图像完全加载并在地图中单击,动画队列就会启动。但这还远远不够完美过渡完全不是流动的,导致动画之间有一点停顿,这会破坏结果。我已经尝试了好几个小时,玩弄超时,重新思考算法,强迫线性转换,但没有结果


我的主要目标是实现一个流体动画,然后为整个动画重新创建一个全局放松效果,如“swing”,随着中间图像的动画化而逐步加速。

所以我花了最后几个小时来找出这里的问题所在,下面是您应该注入的代码

jQuery.easing = {
    zoom: function( p ) {
        return (3*p + Math.pow( p, 2 ))/4;
    }
};
之后,您可以在代码中使用
easing:“zoom”

非常可笑的是,在jQuery UI中有32种不同的版本,但没有缩放