Jump to content
Search Community

Repeating/looping a bunch of tweens

Gumbo test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts


I'm new to all this, so excuse my lack of technical expertise.

I've created an html5 banner and I have this set of words (WE, LIVE OUR, INVESTMENTS), moving up to sit on the banner and then move off.

I want this to repeat/ loop an infinite or at least 50 number of times, but can't find the correct code. Can someone help me?


TweenLite.from(WE, .4, {top:"140", delay:.2});
TweenLite.from(LIVE, .4, {top:"140", delay:.4});
TweenLite.from(OUR, .4, {top:"140", delay:.6});
TweenLite.from(INVESTMENTS, .4, {top:"140", delay:.8});
TweenLite.to(WE, .4, {top:"-40", delay:3.2});
TweenLite.to(LIVE, .4, {top:"-40", delay:3.4});
TweenLite.to(OUR, .4, {top:"-40", delay:3.6});
TweenLite.to(INVESTMENTS, .4, {top:"-40", delay:3.8});



Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,


For creating sequences we recommend our timeline tools TimelineLite and TimelineMax (for repeating)

Please watch this video that shows how you can take TweenLite code very similar to yours and convert it into a timeline:



This video here shows you how to fine-tune the placement of your tweens using the position parameter: http://greensock.com/position-parameter


Once you understand the concepts in both those videos you will be in very good shape.


Here is a very basic example of a repeating sequence: 


var tl = new TimelineMax({repeat:2. repeatDelay:1})

tl.to("#redBox", 1, {x:550}) //move red box
  .to("#blueBox", 1, {x:550}, "-=0.5") // move blue box 0.5 seconds before previous tween ends
  .to(".box", 1, {opacity:0, scale:0}); // fade out both boxes

demo: http://codepen.io/GreenSock/pen/LEdwZm?editors=001


If you need more help after watching those videos please provide a very basic demo as explained here: http://greensock.com/forums/topic/9002-read-this-first-how-to-create-a-codepen-demo/

  • Like 2
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.
  • Create New...