Share Posted April 21 Hi, I think I do it this wrong… and it's not like expected 😕 See the Pen jOeVoaO by benoitwimart (@benoitwimart) on CodePen Link to comment Share on other sites More sharing options...
Share Posted April 21 Hi there - could you explain what are you expecting and what is wrong? Thanks! Link to comment Share on other sites More sharing options...
Author Share Posted April 21 The final sub timeline will be more complexe (like Morph), but for now with the same mouvement and the same seek, positions are different. Link to comment Share on other sites More sharing options...
Share Posted April 21 Sorry that's not making much sense to me - could you try again? What is it that you are trying to attempt with the code you've linked to above? What is happening, and what do you think the result should be. Link to comment Share on other sites More sharing options...
Author Share Posted April 21 Codepen updated with comments and result under the line… Link to comment Share on other sites More sharing options...
Share Posted April 21 Oh, alright - I think the confusion is that you're creating a new timeline every time you call your timeline creation function - tlsub('.a') or tlsub('.b') So when you call seek again, you're not calling seek on the first timeline, you're making a new timeline with a new animation on the same element and calling seek on that second timeline. I can't really advise on a better route because I'm not sure of the end goal. But that's what's happening. 1 Link to comment Share on other sites More sharing options...
Author Share Posted April 21 OK, I will make an array of TL 1 Link to comment Share on other sites More sharing options...
Share Posted April 21 This may help too? Another way to grab a timeline after creationhttps://greensock.com/docs/v3/GSAP/Timeline/getById() Link to comment Share on other sites More sharing options...
Author Share Posted April 21 Is there a better way to make this, without "tl.call()" ? Link to comment Share on other sites More sharing options...
Author Share Posted April 21 4 minutes ago, Cassie said: This may help too? Another way to grab a timeline after creationhttps://greensock.com/docs/v3/GSAP/Timeline/getById() I will try to remember this >< Link to comment Share on other sites More sharing options...
Solution Solution Share Posted April 21 I glanced at your code too and I'm very confused about what you're trying to do. If you can explain your goal, perhaps we can offer advice on a better way to accomplish it. You seem to be misunderstanding how things are supposed to work or the logic flow. Let's consider just these two lines: tl.call(e=>tlsub('.a').seek(5,false),null,1); // go to 5s -> 250px is OK tl.call(e=>tlsub('.a').seek(2,false),null,2); // go to 2s -> 100px is not OK When the timeline reaches 1 second, it calls that first line which creates a whole new paused timeline animating the element's x from wherever it is currently (0) to 500 over the course of 10 seconds, so since you seek(5), that means it's halfway to 10, thus x is 250. Great. Then the next line creates a whole new paused timeline animating the element's x from wherever it is currently (250) to 500 over the course of 10 seconds. Since you then seek(2), that's 20% of the way from 250 to 500 which is 300. Everything is working exactly the way you've asked it to. But again, I don't really understand why you're doing all this so it's hard for me to offer advice. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now