Jump to content
GreenSock

Mo5

scrollTrigger: progress bar become full and empty in different duration

Go to solution Solved by awazigh,

Recommended Posts

I have a progress bar and I want it to become full in 15 seconds but empty in 5 seconds  

See the Pen QWmYxyb by Mo2S (@Mo2S) on CodePen

Link to comment
Share on other sites

  • Mo5 changed the title to scrollTrigger: progress bar become full and empty in different duration
  • Solution

Hey Mo!

Something like this?

const tlBar = gsap.timeline({paused: true})

tlBar.from('.two span',{
    scaleX:0,
    transformOrigin: "left center", 
})

ScrollTrigger.create({
  trigger:'.two',
  start:'center center',
  markers:true,
  onEnter: () => {
    tlBar.play().duration(15)
  },
  onLeaveBack: () => {
    tlBar.reverse().duration(5)
  }
});

 

  • Like 3
Link to comment
Share on other sites

yea! that's what I want... Thank you so much!

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