Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
BornToCreate

MorphSVG not working

Recommended Posts

Hello,

Im trying to use MorphSVG but it isnt working.

I made a realy simple example but even this doesnt work.

So basically I want to first use DrawSVG to draw a stroke and then morph it into a filled shape (not in codepen).

But the morphSVG isnt working.

I created a very basic codepen and even this is not working.

Could it be because of my SVG?

 

See the Pen QyOrKr by TheM (@TheM) on CodePen

Link to comment
Share on other sites

Thanks for the very simple example. 

 

The main problem is that the rect you are morphing starts as a rect with width="100" and height="100", and your end shape is a rect with the same dimensions. Basically there is nothing to morph:)

 

Also, I noticed that your end shape had a fill color. Fill is ignored, MorphSVG only cares about animating the path data. 

 

Here I just changed the width and height of your end rect to be smaller 80 x 80.

 

http://codepen.io/GreenSock/pen/LGOrEy?editors=001

 

not sure what's going on with the stroke though.

Link to comment
Share on other sites

Strokes always put half of the width on each side of the vector, so the reason the stroke looks thinner on the top/left is because it's getting clipped by the <svg> itself. In other words, it's spilling outside the visible area. If you put overflow: visible on your <svg> css, you'll see it :)

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