Jump to content
Search Community

loop back to beginning on a slider

harp30 test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello,

I'm trying to recreate this slider: https://bewegen.com/en its under the Accelerating Bike Share section.
I managed to create the count slider but having trouble getting it back to count 1 when it hits the end count of 9 - smoothly have it loop back to the start.

How to get the count to loop back to the start?

Thank you.

See the Pen GYEXXe by harp30 (@harp30) on CodePen

Link to comment
Share on other sites

Hello @harp30 and Welcome to the GreenSock Forum!

 

To do that you can use the GSAP Modifiers Plugin to create a seamless/infinite loop of your elements movement.

 

https://greensock.com/docs/Plugins/ModifiersPlugin

 

Here is codepen that use this concept horizontally, but can be used for vertical by using y instead of x:

 

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

 

I hope this helps, Happy Tweening :)

 

  • Like 6
Link to comment
Share on other sites

  • 1 year later...
On 10/12/2018 at 7:11 PM, Carl said:

yup and just to add onto Jonathan's advice, here you can see some buttons to navigate

 

be sure to read this thread for more info on what is happening and how it works

 

https://greensock.com/forums/topic/16952-modifiers-plugin-for-infinite-image-carousel/

 

 

 

 

 

 

 

Great example, but If I have to stop it at a particular number dynamically after few spins?

Link to comment
Share on other sites

8 hours ago, ZachSaucier said:

That's a wholly different subject. Check out this thread:

 

This demo is different than what I am asking. I need to stop the wrap-around slider at a particular side, in the wheel demo, there is no ModifiersPlugin usage.

Link to comment
Share on other sites

  • 9 months later...
On 10/12/2018 at 9:41 AM, Carl said:

yup and just to add onto Jonathan's advice, here you can see some buttons to navigate

 

be sure to read this thread for more info on what is happening and how it works

 

https://greensock.com/forums/topic/16952-modifiers-plugin-for-infinite-image-carousel/

 

 

 

 

 

 

 

@Carl This is great! I've been trying to modify the code to work in percentages. Specifically using css: {left: "-=100%"} so the slides (boxes) can scale if the browser window scales. I haven't had any luck.

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