Jump to content
Search Community

Change Marquee direction on scroll

axiome test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

Hi Everyone, 

 

I'm new with Gsap and I want to make an infinite marquee, and change direction of the marquee if you scroll up or down.

I succeeded to make it from right to left, but I don't have any idea how to proceed to change direction.

 

The effect I want to reproduce is based on the Locomotive Agency website : https://locomotive.ca/fr

 

Thank you.

See the Pen abpyGQy by bappla (@bappla) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @axiome

 

You can animate the timeScale of an animation.

 

So something like this.

 

let tween = gsap.to(".marquee__part", {
  xPercent: -100, 
  repeat: -1, 
  duration: 10, 
  ease: "linear"
}).totalProgress(0.5);

...
gsap.to(tween, {
  timeScale: someCondition ? 1 : -1 // -1 will reverse the animation
});

 

 

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