Jump to content
GreenSock

geedix

timeline seek not seeking

Go to solution Solved by PointC,

Recommended Posts

I have done something like this before with success, but tonight, I can't make my timeline skip ahead. 

It logs 'true' for me if I set my mac to prefer reduced motion, or do it in dev tools, but it won't "seek" a future time or label. What am I forgetting?

thanks

 

See the Pen zYPeBXQ?editors=1111 by geedix (@geedix) on CodePen

Link to comment
Share on other sites

I guess I don't understand "seek" because I just skipped all the prefers-reduced-motion stuff and I still can't get it to seek a label. 

Link to comment
Share on other sites

  • Solution

You'll need to seek that label after the timeline is created. Just move your seek and you'll be good to go.

// tl.seek('end'); // nope

tl.to("circle", { x: 140, duration: 3 })
  .to("circle", { scale: 1.2, fill: "gold", duration: 2 }, "f1")
  .to("circle", { y: 40, duration: 2 }, "f1")
  .to("circle", { x: 60, y: 5, scale: 0.4, duration: 2 })
  .to("circle", { scale: 1 }, "end");
tl.seek('end');

Happy tweening.

:)

 

  • Like 2
Link to comment
Share on other sites

Thanks. I thought javascript would follow instructions in sequence, meaning the timeline would run each tween and THEN run the seek command at the bottom. And I thought that declaring the timeline as a variable was the same thing as creating it. But I see now that I was mistaken.

 

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