Jump to content


Coed for repeating/looping a tween

Moderator Tag

Recommended Posts

I realise the AS command to repeat a tween action is


repeat : number of repeats


But where does this go in my code:



import com.greensock.*;


TweenLite.to(test, 2, {x:198, y:250, rotation:30});


TweenLite.to(test2, 2, {x:300, y:250, rotation:60});


Sorry for the simple question but I am fairly new to tween classes...

Link to comment
Share on other sites

Hi Trixiemay,


Welcome to the GreenSock forums.


repeat is a special property of TweenLite's big brother TweenMax


Your code should look like this:



import com.greensock.*;

TweenMax.to(test, 2, {x:198, y:250, rotation:30, repeat:5}); // will repeat 5 times


also, see what yoyo does:


TweenMax.to(test, 2, {x:198, y:250, rotation:30, repeat:5, yoyo:true}); //tween will play back and forth



Take a look at more features of TweenMax here:




let us know if you have any other questions


Happy Tweening!

Link to comment
Share on other sites

Thanks Carl. That's great!


My other question was regarding a particle system. I have a diagram of some particles flowing through different chambers. But I am looking at having the particles flow continuously. I presume that using TweenMax will have a definite start and end.


So can it be used for a constant flow? I don't really want to use a particle stream as there a number of particles that have to be different sizes and colours.



Link to comment
Share on other sites

perhaps i need to understand better what you mean by a constant flow, but I'm sure you can generate enough repeating particles at the right timing interval to simulate a constant flow.


I would suggest looking into the LinePath2D tools: http://www.greensock.com/as/docs/tween/com/greensock/motionPaths/LinePath2D.html


copy and paste the code from the docs into a blank fla. cool stuff!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.