Jump to content
Search Community

Artisan Digital

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Artisan Digital

  1. Hey guys,

     

    Just wondering if there is an easier way to first start a loop, then stop it.

     

    Let's start with this:

    //Single object loop
    
    function doTween():void {
        TweenLite.to(mc, 1, {rotation:"348", ease:Linear.easeNone, onComplete:doTween});
    }
    doTween();
    
    //Stop loop
    
    TweenLite.killTweensOf(mc);
    
    
    //Multiple object loop
    
    function doTween():void {
        TweenLite.to(mc_01, 1, {rotation:"348", ease:Linear.easeNone, onComplete:doTween});
        TweenLite.to(mc_02, 1, {rotation:"348", ease:Linear.easeNone});
        TweenLite.to(mc_03, 1, {rotation:"348", ease:Linear.easeNone});
    }
    doTween();
    
    //Stop loop
    
    TweenLite.killTweensOf(mc_01);
    TweenLite.killTweensOf(mc_02);
    TweenLite.killTweensOf(mc_03);
    

    If there are heaps of objects looping, is there an easier way to stop them all (like by stopping the function somehow)?

     

    Also in case 2, let's just say there is a grandfather clock swinging. You can't use the above method because it needs to go back and forth.

    function tilt_right() {
        TweenLite.to(mc, 1, {_rotation:30, onComplete:tilt_left, } );
    }
    function tilt_left() {
        TweenLite.to(mc, 1, {_rotation:-30, onComplete:tilt_right, } );
    }
    tilt_right();
    

    Once I want it to stop looping, what code would I use?

     

    I could possibly use the killTweensOf method again, but if each function had heaps of tweens, it seems like a clunky way of doing it.

     

    Thanks guys,

    Rhys.

×
×
  • Create New...