geedix Posted February 9, 2023 Share Posted February 9, 2023 I know how to start a tween from a certain point in its progress: tween1.progress(0.33); But likewise, is there a simple way of stopping a tween at a specified progress point? My codepen does roughly what I want, but it seems like there should be a more elegant way to finish each tween somewhere in the middle without making a new tween. See the Pen jOpRmqO?editors=1111 by geedix (@geedix) on CodePen Link to comment Share on other sites More sharing options...
Solution GreenSock Posted February 9, 2023 Solution Share Posted February 9, 2023 I had a hard time following your demo based on your question. If you want to make the playhead of a particular tween go from one spot to another (not from the beginning to the end), you can just pause() that tween and then tween its playhead. Here's a simple function that shows how it could be done in a reusable way: let tween = gsap.to(...); tweenFromTo(tween, 0.33, 0.66); function tweenFromTo(tween, fromProgress, toProgress) { tween.pause(); gsap.fromTo(tween, {progress: fromProgress}, {progress: toProgress, duration: Math.abs(tween.duration() * (toProgress - fromProgress)), ease: "none"}); } Does that help? There are several other ways you could accomplish this, but I didn't want to overwhelm you If you still need assistance, can you please greatly simplify things to just one tween maybe and make the demo illustrate exactly what you're aiming for? Link to comment Share on other sites More sharing options...
geedix Posted February 9, 2023 Author Share Posted February 9, 2023 Thanks, the ability to play a tween from and to progress value is all I was looking for. 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