Jump to content
Search Community

Marquee Animation GSAP

Atul Singh test
Moderator Tag

Recommended Posts

Hello everyone,
I'm attempting to add a marquee animation that scrolls text from left to right and right to left. It's functioning correctly on desktop devices, but there's an issue on mobile devices. On mobile, the full text isn't scrolling properly. Can anyone help me with this? Thank You.
 

See the Pen qBLGvGm by atulkumarsingh (@atulkumarsingh) on CodePen

Link to comment
Share on other sites

Hi,

 

You should try the Horizontal Loop helper function:

https://gsap.com/docs/v3/HelperFunctions/helpers/seamlessLoop

 

Here is integrated with the Observer plugin in order to switch directions based on the scroll direction:

See the Pen zYaxEKV by GreenSock (@GreenSock) on CodePen

 

Here is the same effect but using ScrollTrigger:

See the Pen GRwePYw by GreenSock (@GreenSock) on CodePen

 

Hopefully this helps.

Happy Tweening!

Link to comment
Share on other sites

Hi, 

 

There are a few issues in your demo. You have just one element being passed to the helper function. While it works it does have a drawback of the element jumping at the end of the animation. It's highly recommended to have at least two elements.

 

Here is an example that shows how to create two different loop instances in opposite directions:

See the Pen gOBaGVo by GreenSock (@GreenSock) on CodePen

 

Then the procedure is the same, just check for the ScrollTrigger instance's update and direction in order to update their timescale according to that:

See the Pen QWQYmaN by GreenSock (@GreenSock) on CodePen

 

Hopefully this helps.

Happy Tweening!

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