Jump to content
Search Community

Multiple DrawSVG Elements with same Timeline Trigger

lemonetti test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

You'll need to scope your elements to the current loop you're on. I don't use jQuery, so I'm not 100% sure if what I did was correct, but I thought it worked like this jQuery('.someElm', myScope). Where myScope is the the parent element where you want to limit the scope to. In normal Javascript document.querySelectorAll('.someElm'), gets you all the elements on the page, but myScope.querySelectorAll('.someElm') gets you only the elements within myScope. 

 

Also GSAP has a solution for this, see https://greensock.com/docs/v3/GSAP/UtilityMethods/selector() where you can scope elements that way. Hope it helps and happy tweening! 

 

See the Pen PoayNdN?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • Solution

Are you talking about .highlight-slider-line-a and .highlight-slider-line-b? These are not scoped. I've wrapped them in q(".highlight-slider-line-a") to scope them to the current lineTrigger. I don't know what your .hide() function is doing, but it is being called multiple times, so I advies you do do some more research to how that works in jQuery or just use GSAP for that gsap.set(q(".circle-line-2"), {opacity: 0})

 

See the Pen vYrwdPm?editors=0011 by mvaneijgen (@mvaneijgen) on CodePen

  • Like 2
Link to comment
Share on other sites

Hello,

 

unfortunately I stumbled upon another problem. I want to add a class on completion of the first line to animate the element. And then remove the class when I scroll up again and trigger the Line Animation in the other direction. With the first line it works as intended, but for some reason the onReverseComplete gets also triggered by the second line, which it shouldn't..

 

Here's my pen:

See the Pen NWzQezW by clmsftsw (@clmsftsw) on CodePen

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