muldy Posted April 4, 2011 Share Posted April 4, 2011 Im just novice in tweenmax. How i repeat my movie there are code: import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; TweenPlugin.activate([bezierPlugin]); TweenMax.from(logo, 1.2,{scaleX:0, scaleY:0, ease:Back.easeOut, onCompleteListener:kill}); TweenMax.from(logo1, .6,{scaleX:0, scaleY:0, ease:Back.easeOut, delay:.6, onCompleteListener:kill}); corm.alpha = 0; import com.greensock.events.TweenEvent; function kill(event:TweenEvent):void { TweenMax.to (event.target.target, 0, {alpha:0}); } TweenMax.to(corm, 1, {alpha:1, delay:1.4}); TweenMax.to(text1, 0.35, {bezierThrough:[{x:250, y:83}],ease:Back.easeOut, delay:1.4}); TweenMax. from(text1, 1, {autoAlpha:0, delay:1.4}); Please help me! Link to comment Share on other sites More sharing options...
X10 Posted April 4, 2011 Share Posted April 4, 2011 Hi Muldy, There are 2 ways you could repeat this animation. 1) Put the Tweens into a TimeLineLite or TimeLineMax. var myTimeline:TimelineMax = new TimelineMax({repeat:2, repeatDelay:1.5}); myTimeline.append(TweenMax.from(logo, 1.2,{scaleX:0, scaleY:0, ease:Back.easeOut, onCompleteListener:kill})); myTimeline.append(TweenMax.from(logo1, .6,{scaleX:0, scaleY:0, ease:Back.easeOut, delay:.6, onCompleteListener:kill})); .... Where it says repeat:2 you can use repeat:-1 to repeat infinitely, have a look at the documentation if you need some help in the explanations. 2) Put your tweens into a function and at the end call the function function myAnimation():void{ TweenMax.from(logo, 1.2,{scaleX:0, scaleY:0, ease:Back.easeOut, onCompleteListener:kill}); TweenMax.from(logo1, .6,{scaleX:0, scaleY:0, ease:Back.easeOut, delay:.6, onCompleteListener:kill}); .... myAnimation(); } if you need a delay before the animation repeats you can use the Delayed Call feature of TweenMax, so instead of just myAnimation() above you could have: TweenMax.delayedCall(2, myAnimation); Where 2 represents the number of seconds before the call to the function is made (assuming you are using time for your timing mode instead of frames). I hope this all makes sense, give us a shout back if you have further questions or run into trouble. X10 EDIT: Missed a semi-colon in the code above. Link to comment Share on other sites More sharing options...
muldy Posted April 4, 2011 Author Share Posted April 4, 2011 function myAnimation():void{ TweenMax.from(logo, 1.2,{scaleX:0, scaleY:0, ease:Back.easeOut, onCompleteListener:kill}); TweenMax.from(logo1, .6,{scaleX:0, scaleY:0, ease:Back.easeOut, delay:.6, onCompleteListener:kill}); .... myAnimation() } this is did't work??? animation stop. Link to comment Share on other sites More sharing options...
Carl Posted April 4, 2011 Share Posted April 4, 2011 x10 has great advice. in addition you don't need a listener to change alpha of an object when it is done tweening. you can use the visible plugin: see it in action in the plugin explorer: http://www.tweenmax.com/ or watch a quick video and get source code: http://www.snorkl.tv/2011/02/five-hidde ... tweenlite/ myTimeline.append(TweenMax.from(logo, 1.2,{scaleX:0, scaleY:0, ease:Back.easeOut, visible:false})); Link to comment Share on other sites More sharing options...
muldy Posted April 4, 2011 Author Share Posted April 4, 2011 Thanks for help guys!! But this code didnt work function myAnimation():void{ TweenMax.from(logo, 1.2,{scaleX:0, scaleY:0, ease:Back.easeOut, onCompleteListener:kill}); TweenMax.from(logo1, .6,{scaleX:0, scaleY:0, ease:Back.easeOut, delay:.6, onCompleteListener:kill}); myAnimation(); } What wrong?? Link to comment Share on other sites More sharing options...
X10 Posted April 4, 2011 Share Posted April 4, 2011 Hi muldy, can you be a bit more specific with how it's not working so we can provide further assistance, if you could post the error Flash gives you that would be good. Just to clarify, where I typed: function myAnimation():void{ TweenMax.from(logo, 1.2,{scaleX:0, scaleY:0, ease:Back.easeOut, onCompleteListener:kill}); TweenMax.from(logo1, .6,{scaleX:0, scaleY:0, ease:Back.easeOut, delay:.6, onCompleteListener:kill}); .... myAnimation(); } the "...." means "the rest of your code" and myAnimation(); goes at the end. Just in case that wasn't clear X10 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now