Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
c05dk

Custom slider counter

Recommended Posts

Hi there, I am needing to create a custom slider counter. I am currently trying to plan how this maybe done. The screenshot is attached and this is what it needs to look like. 

 

I was thinking of completing this using the drawsvg plugin but unsure how it will be done. For now I am not looking at making this dynamic but how could I create this on my site and then have it draw on each slide. I am using slick slider. Is there any examples of a draw svg for slider

 

Share this post


Link to post
Share on other sites

Hey c05dk. 

 

DrawSVGPlugin isn't built to work with dashed lines (because in order to draw the line you need to use dashes which overrides the original dashes). But if you have a solid colored background like you do in the image above you can fake it using layered paths like this post shows:

Otherwise you'll have to animate a mask or clip path to reveal the dashed line which is more complicated but doable.

 

We also have a helper function that animates a line along a path to particular anchors that may be useful to you: https://greensock.com/docs/v3/HelperFunctions#anchorsToProgress

 

In terms of getting this working with a slider, on the slider's change event you could animate to the next or previous point based on the index. 

Share this post


Link to post
Share on other sites

Wow, @mikel you are so helpful! Users in these forums should pay you for your work :) 

  • Haha 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×