Jump to content
Search Community

seamless loop gap issue at the end

codechirag
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

Posted

Hey guys, I am using seamless horizontal loop but having issue of spacing at the end. it is not maintaining proper space at the last item. here is the pen. Help is appreciated.

See the Pen QWXNqxL by EmpChirag (@EmpChirag) on CodePen.

  • Solution
Posted

the gap property only adds space between items and not to the first or last item, in this case you do want this start and end item to have space, so that when the whole block loops it has the space baked in to the whole block. So adding space using any of the old school methods is your best bet. Hope it helps and happy tweening! 

 

See the Pen LYKNgby?editors=0100 by mvaneijgen (@mvaneijgen) on CodePen.

  • Like 1
  • Thanks 1
  • 2 months later...
Posted

Hi @mvaneijgen, I have the similar kind of issue so not creating new post, Hope that's right and if not please correct me,

I am having issue while I use this loop just before the end of the element the loop gets reset. 

 

See the Pen NWQPvGb by EmpChirag (@EmpChirag) on CodePen.

Posted

The seamless loop helper function uses the elements to loop, so adding some element around each of the text element end using that in th helper function fixes your issue. Hope it helps and happy tweening! 

 

See the Pen NWQPvLa?editors=1000 by mvaneijgen (@mvaneijgen) on CodePen.

  • Like 1
Posted

Yep, as Mitchel mentions the Horizontal Loop helper function works with DOM elements not single words, those are just the content of a DOM element nothing more. In @codechirag's demo the helper function sees just one element so it moves that single element to the left and when that is done, the element is set back to it's starting position, which is exactly what the helper function does. There is no way the helper function can check the text string inside it and create DOM nodes in order to work the way you expect, for that you need to use SplitText:

https://gsap.com/docs/v3/Plugins/SplitText/

Posted

Hey Guys @mvaneijgen @Rodrigo, Thanks a lot you guys are awesome. Now I understand the thing but one last thing I wanted to ask, at the end sometimes  the function takes time to regenerate the elements it shows blank space for a while.

Posted

Hi,

 

I'm not seeing that behaviour in Mitchel's demo, everything seems to be working as expected 🤷‍♂️

Posted

You have some elements between the words that have margins of 71 px, just add that to the config of the helper function (is right there in the documentation, on the comments of the helper FYI):

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

 

horizontalLoop('.loop div', { duration: 30, repeat: -1, paddingRight: 71, });

Hopefully this helps

Happy Tweening!

  • Thanks 1
  • 4 months later...
codechirag
Posted

Hi @mvaneijgen ,

 

I don't know why but I get some issue everytime I use helper function. right now the right side line animation stops randomly and starts again.

 

See the Pen NPWNMyL by EmpChirag (@EmpChirag) on CodePen.

Posted

Hi,

 

There has to be something wrong in your HTML setup because this is working as expected:

See the Pen zxYqLaM by GreenSock (@GreenSock) on CodePen.

 

Also you're using what seems to be a very outdated version of the helper function. Always go to our codepen demos in this URL in order to get the latest version of the Seamless Loop helpers and other helper functions as well:

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

 

Hopefully this helps

Happy Tweening!

  • Thanks 1
codechirag
Posted

@Rodrigo Hey thanks a lot I have used this code and worked fine.

  • Like 1
codechirag
Posted

@Rodrigo I have encountered 1 thing in your code as well the margin gap becomes inconsistent between the images.

image.png.ab072f5470f542455f0bc040034ed0f8.png

Posted

Mhhh... I tested the demo in different browsers on Ubuntu and Mac without seeing any difference in the vertical margins 🤷‍♂️

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