无限重复动画

时间:2014-07-22 16:43:28

标签: greensock tweenlite

为什么绿色和黄色块在这里循环:

http://jsfiddle.net/NK3pe/23/

但尚未在这里:

http://jsfiddle.net/NK3pe/27/

var trackMaster = new TimelineLite({ paused: false, repeat: -1 });

function addParticle(particleClass){
    $('#display').append("<div class='" + particleClass + "' style='color: black'></div>"); 
}

for(i = 0; i < 300; i++){
   var particle = addParticle('slow');

   trackMaster.insertMultiple( TweenLite.from( $('.slow')[i], Math.random() * 20, { left:'+=200', ease: Linear.easeNone, repeat: -1 }), 0 );

}

function midAnimation(){
     trackMaster.time(8);   
}

$('#restart').on('click', function(){
    trackMaster.restart();
});

$('#pause').on('click', function(){
    trackMaster.pause();
});

$('#resume').on('click', function(){
    trackMaster.resume();
});

我正在应用repeat: -1选项。如果我repeat: 2 ......

,它就不会重复

1 个答案:

答案 0 :(得分:2)

更改: trackMaster.insertMultiple( TweenLite.from( $('.slow')[i], Math.random() * 20, { left:'+=200', ease: Linear.easeNone, repeat: -1 }), 0 );

来: trackMaster.from( $('.slow')[i], Math.random() * 20, { left:'+=200', ease: Linear.easeNone, repeat: 33 }, 0 );