Jump to content
GreenSock

Ivan

Repeat one animation in timeline

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

Hello!
Tell me, please, can i repeat only one animation in a timeline?
If I do this - its working only one time:

 

var tl = new TimelineMax();

tl.to('#photo', 1.5, { left: '0' })
.to('.text_top_item', 1.5, { autoAlpha: 1 })
.to('.text_top_item2', 0.5, { scale: 1.08, repeat: 3, yoyo: true });
Link to comment
Share on other sites

Hi,

 

Yes, you can repeat any tween in a timeline any number of times, but the trick is that it has to be a TweenMax tween.

 

When you use the .to(), .from(), or .fromTo() methods of TimelineLite/Max, they insert TweenLite tweens into the timeline. 

 

In order to keep things light-weight and minimize dependencies we didn't want to require folks to have all of TweenMax loaded in order to use these timeline methods.

 

The solution is to use the add() method to add a TweenMax tween like so

.add( TweenMax.to( element, 1, {scale:2, repeat:3, yoyo:true}) )

TimelineLite.add()

 

Let us know if you need more clarification.

  • Like 2
Link to comment
Share on other sites

Great! Thanks!

And one more thing: GSAP amamizing platform!

  • Like 3
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.
×