Jump to content
Search Community

Repeat / seek label

anonty 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

My timeline looks like this:

 

.addLabel('one')

  .to(move something)

  .to(move something else)

.addLabel('two')

  .to(move something)

  .to(move it back to original position)

  .addPause('+=1', function() { depending on the value of a var repeat label 'one' or 'two' } )

 

What should I use for the last part? When I use .seek('two') it jumps to .addPause(). How do I repeat everything under label 'two'?

 

Link to comment
Share on other sites

Hi agonty,

 

I really don't understand what you mean by

 

When I use .seek('two') it jumps to .addPause().

 

it was very nice for Mikel to create a demo for you, can you explain how seek('two') isn't working as expected even without adding and removing the pause.


 

var action = new TimelineMax()
.addLabel('one')
.to('#green01',1,{x:100})
.to('#green02',1,{x:100})
.addLabel('two')
.to('#green03',1,{x:100})
.to('#green03',1,{x:0})
.addPause("+=1", again);



function again(){
  action.seek('two');
}

 

The code above makes the last 2 tweens repeat forever as I would expect:

 

See the Pen pqrzJo?editors=0010 by GreenSock (@GreenSock) on CodePen

 

 

If you need to edit that demo to replicate your issue, feel free.

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