Javascript jQuery的跟踪效果?

Javascript jQuery的跟踪效果?,javascript,jquery,effect,trail,Javascript,Jquery,Effect,Trail,这能做到吗?基本上我想用right:xxxPX制作一个绝对定位的图像动画。那么,当动画正在进行时,我可以添加一个轨迹效果吗 谢谢, 阿德里安这应该行得通: var box = $('#box'), // Create some clones (these make up the trail) clones = $.map(Array(10), function(item, i){ return box.clone().css('opacity', 1 / (i +

这能做到吗?基本上我想用right:xxxPX制作一个绝对定位的图像动画。那么,当动画正在进行时,我可以添加一个轨迹效果吗

谢谢, 阿德里安这应该行得通:

var box = $('#box'),
    // Create some clones (these make up the trail)
    clones = $.map(Array(10), function(item, i){
        return box.clone().css('opacity', 1 / (i + 1)).hide().insertAfter(box);
    });

box.animate({
    top: 100,
    left: 200
}, {
    duration: 1000,
    step: function(now, fx) {

        // On each step, set a timeout for each clone,
        // making it move to the required position.

        var prop = fx.prop;

        $.each(clones, function(i, clone){
            clone = $(clone).show();
            setTimeout(function(){
                clone.css(prop, now);
            }, 50 * i);
        });

    }
});

演示:

如何追踪?你能说得更具体一点吗?像windows的光标轨迹效果?詹姆斯·古德温,是的,像那样棒极了!现在,让盒子在页面内跟随鼠标并不断留下痕迹如何?