Jump to content
Search Community

ScrollTrigger + DrawSVG

RBari test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hey GSAP! I created a layered pinning from the bottom.  Codepen Link below 👇.

 

Here's the problem: When I scroll, I want to scrub through the drawing of America using drawSVG, but that's not working.

 

How I tried fixing it: Using scrollTrigger, I tied the scrubbing of the svg path to the scrollbar: 

gsap.to('.america',{
    scrollTrigger: {
        trigger: '.obama',
        start: 'top center',
        end: 'top 400px',
        scrub: 1
    },
    drawSVG:0, 
    repeat:10, 
    yoyo:true
});

image.thumb.png.6cf399f3423c9e778fe17af28486a376.png

 

I would greatly appreciate it if someone could help out. Thank you!

See the Pen dyvVqvg?editors=1000 by Refath (@Refath) on CodePen

Link to comment
Share on other sites

  • Solution

Welcome to the forums, @RBari

 

You just forgot to load DrawSVGPlugin and you had some very odd values in your animation, like repeat: 10. And the start position was off. I assume this is kinda what you were looking for?: 

See the Pen XWMexbP?editors=1010 by GreenSock (@GreenSock) on CodePen

 

Just keep in mind that DrawSVGPlugin is a membership benefit of Club GreenSock, so you'll need to sign up to get the full version that works outside of CodePen. 

 

Happy tweening!

  • Like 1
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...