Jump to content
GreenSock

Rohit Girdhar

Morph SVG on Scroll

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

 
 

I am trying to morph SVG on scroll. I have two shapes with id's #shape-1 and #shape-2. What I want is after say 20px of scroll shape-1 morphs into shape-2 and when we again scroll back up the shape-2 reverts back to shape-1.

 

I am able to morph the first time but can't seem to get the proper logic to morph every time the user scrolls above or below a certain scroll value (20px for instance).

See the Pen owYqBE by rohitgd (@rohitgd) on CodePen

Link to comment
Share on other sites

Hi Rohit Girdhar

 

Welcome to GreenSock Forums.

 

This is one option:

See the Pen bRByJQ by mikeK (@mikeK) on CodePen


Just reverse it.

 

Happy tweening
Manfred

  • Like 3
Link to comment
Share on other sites

Thank you for the answer! Just what I was looking for.

  • Like 3
Link to comment
Share on other sites

Not sure, But I think ScrollMagic could also be used for this. 

 

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