Jump to content
Search Community

Using morphSVG with shapeIndex ignores duration

maki3000 test
Moderator Tag

Recommended Posts

When I use morphSVG with shapeIndex duration the duration is ignored.

 

I do:

morphSVG.convertToPath('#letter-k-polygon, #letter-ki-svg-morph-rect')
gsap.to('#letter-k-polygon', { morphSVG: { shape: '#letter-ki-svg-morph-rect', shapeIndex: 12, duration: 10 } })

Like this the animation goes quite fast.

 

But when I do:

gsap.to('#letter-k-polygon', { morphSVG: '#letter-ki-svg-morph-rect', duration: 10 })

The animation duration is 10 seconds.

 

What am I doing wrong?

 

Sorry, I can't add a CodePen, because I don't know how to get around restricted use of morphSVG...

Link to comment
Share on other sites

That's because you put the duration INSIDE the morphSVG object, but it doesn't belong there.

// BAD
{morphSVG:{ shape: "#...", shapeIndex: 12, duration: 10}}

// GOOD
{morphSVG:{ shape: "#...", shapeIndex: 12}, duration: 10}

As for using MorphSVG on CodePen, you can use all the bonus plugins for free there. See

 (there are special trial versions that only work on whitelisted domains).

 

Happy tweening!

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