Jump to content
Search Community

Is there a way to scrub a timeline using a scrollTrigger OR by dragging left and right?

MartinSansom test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

Hi everyone,

 

I'm trying to create an image sequence that can be played backwards or forwards by scrolling the page up and down. But I also need the sequence to be controllable using a video style progress bar.

 

Using some of the code that I've copied from these forums I've managed to get the image sequence working and I've also managed to create a play bar control with a playhead that can be dragged left and right.

 

But I can't get the playhead to control the current image that is displayed in the image sequence.

 

In the code for the image sequence I specify the number of frames, so I'm assuming I need to divide the length of the progress bar into an equivalent number of 'units' and then advance or rewind the image sequence every time the play head is dragged by one 'unit'. 

See the Pen yLMWwZz by MartinSansom (@MartinSansom) on CodePen

Link to comment
Share on other sites

  • Solution

You can tie the progress in to values from a range slider like this. 

See the Pen a7fd24fd8d7fd6bfdc25f866bf3c00b5?editors=1011 by cassie-codes (@cassie-codes) on CodePen



Doing both scroll and a slider will definitely be possible but you'll have to work out what to do when the slider and scroll conflict. Which values overwrite which?

  • Like 1
Link to comment
Share on other sites

13 hours ago, Cassie said:

You can tie the progress in to values from a range slider like this. 
 

 


Doing both scroll and a slider will definitely be possible but you'll have to work out what to do when the slider and scroll conflict. Which values overwrite which?

 

 

 

Thank you so so so soooooooo much Cassie - your solution worked perfectly!!!!! (and with so few lines of code, I'm falling back in love with GSAP)

  • Like 1
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...