Jump to content
Search Community

How to play single animation when having multiple animations under the same timeline

beqa test
Moderator Tag

Recommended Posts

I have one timeline. inside div I have 3 divs (

position: absolute

)

 

I am pushing animation objects in a array

const anim = mainTimeline.from(...)

animations.push(anim);


but when I try to play animation on specific index, for example animations[2].play()
it plays whole timeline



is it possible to play only specific animation under same timeline?

 

See the Pen RwENdGZ by -aisudhaskudh (@-aisudhaskudh) on CodePen

Link to comment
Share on other sites

Hiya!

 

No you can't use control methods to control a tween on a timeline. You have to control the timeline as a whole. A way to play a section of a timeline would be to use tweenFromTo?

https://greensock.com/docs/v3/GSAP/Timeline/tweenFromTo()

This does seem a bit problematic for your situation though as your timeline is tied to scroll with scrub, so you can't really control it with play/pause. What is you goal here? Maybe we can advise?

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