Jump to content
Search Community

DrawSVG update position

aroy002 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 using the DrawSVGPlugin.GetPosition with good success to check if an SVG has drawn itself to a certain point before triggering a separate animation, like so - 

 

if (DrawSVGPlugin.getPosition(".svg-line #filled")[1] > 60) { 

 

do animation

 

}

 

else {

 

reverse animation

 

}

 

This works great when using the touchpad on my macbook. However, I just noticed on mouse scrollwheels, that it doesn't seem to catch the IF statement condition if I scroll past it in 1 long flick. If I scroll even a small amount afterwards, this triggers the animation. Is there an update function or way to fix this issue?

 

Thanks!

Link to comment
Share on other sites

I wonder if maybe you're using a 3rd party scroll-based library like ScrollMagic? DrawSVGPlugin doesn't concern itself at all with the scroll position, so I'm pretty sure the issue you're mentioning is totally unrelated to GreenSock code. Perhaps it's an issue you should contact the author of the other library about? (Just a guess - like Zach said, it'd be super helpful to see a reduced test case in a codepen or something). 

Link to comment
Share on other sites

I'm not using scrollmagic for this particular animation. I'm using the getPosition value of the DrawSVG plugin to determine a tweenmax animation (fade in). There is no scrollmagic scene code involved. And like I said, it works perfectly on touch pads, because the scrolling is smooth scrolling. With choppy scrolling on a mousewheel, I can "jump over" the position conditional. It recognizes that it went over the value as soon as I start scrolling the second time (either with the mouse or touchpad).

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