Scrub through a Tween group containing chained tweens #631
-
I have a tweenGroup containing tween_a, tween_b & tween_c i first do then pass the time in the this works nicely to the end but i can't scrub in reverse to fix this issue whenever i scrub i stop all the tween and again do is there a better way to achieve scrubbing ? Code snippet
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It was not really designed to go in reverse, especially chained tweens, although in some cases (non-chained) it works to some extent. What you may have to do is instead of chaining, play/stop/update individual tweens at the right time. This brings up the concept of a We'd need to make sure Tweens are fully reversible (just like the Right now, I feel like What could it look like (I thought I wrote something about this in another issue, couldn't find at the moment): // replacement for `tween1.chain(tween2.chain(tween3))`
const timeline1 = new Timeline(tween1, tween2, tween3)
// now set timeline1 to any time (scrub)
timeline1.to(300)
// tweens don't yoyo, but timelines would
timeline1.yoyo() // implies double duration
// perhaps timelines can be composed of timelines
const timeline2 = new Timeline(...)
const timeline3 = new Timeline(timeline1, timeline2)
// ... and it handles the rest. Plus more features that |
Beta Was this translation helpful? Give feedback.
It was not really designed to go in reverse, especially chained tweens, although in some cases (non-chained) it works to some extent.
What you may have to do is instead of chaining, play/stop/update individual tweens at the right time.
This brings up the concept of a
Timeline
sort of API, which I personally believe would be a great addition to the API (whether as a separate package or not, butTween
would need some tweaks for it to work out perfectly).We'd need to make sure Tweens are fully reversible (just like the
.yoyo
feature essentially does).Right now, I feel like
Tween
does too much; that addons likeyoyo
andchain
are essentially what a more broaderTimeline
API can cover, and …