Jump to content
Search Community

getLabelAfter() with addPause, doesn't skip the tween

icdindia test
Moderator Tag

Recommended Posts

Hi

 

I have gone through a lot of posts and found that tweento(getlabelafter()) will take me to the next label.

But the issue is that it doesn't allow me to skip any tween and jump to the next label.

 

Can you please have a look at the codepen n suggest a way to skip a tween so i do not have to wait for the tween to be over before going on to the next label

 

See the Pen Lyeaex?editors=0010 by vikrant-icd (@vikrant-icd) on CodePen

 

 

Link to comment
Share on other sites

I didn't have time to dig through the code yet, but if you just want to jump to that spot on the timeline, I'd imagine it'd be as simple as:

var label = masterTl.getLabelAfter();
masterTl.seek(label);

//or if you want to jump there and pause...
masterTl.pause(label); 

 

Does that help? 

  • Like 2
Link to comment
Share on other sites

Hi,

 

masterTl.seek(label) jumps to the label without playing any animation.

 

but i tried 

masterTl.play(label)

and it works but it is skipping a few slides.

 

If you see the code pen below, it will skip the second slide and go directly to slide 3.

 

Please see if you can help me resolve this issue.

 

See the Pen xdYpxg?editors=0010 by vikrant-icd (@vikrant-icd) on CodePen

 

Thanks

Link to comment
Share on other sites

thanks for the demo. In the future it is helpful to us if you remove all the code that isn't necessary to replicate the problem (like lines 20 -90). It can be overwhelming to see all that if we are in a time crunch. 

 

The reason it appears slides are being skipped is because your first addPause() and the next frame label occur at the same time

0a6bfe26ddec469caa8946ee583529bd.png

 

So when the animation first runs the playhead stops ON "page1s2" and that means that get labelAfter() will return "page1s3". Make sense?

To get around this you could add each label a teensy weensy bit after the addPause like:

 

add("page1s2, "+=0.001");

 

See the Pen PmREaX?editors=0011 by GreenSock (@GreenSock) on CodePen

 

 

 

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...