Jump to content
GreenSock

jstafford

svg morph beginner question

Recommended Posts

Hi,

 

First SVG morph I have done so far and I am trying to do the infamous morph from open menu bars icon to the close menu icon. 

 

Open Menu Icon consists of three paths.

 

1) #open_top_bar  --> morphs into #close_top_bar

 

2)  #open_middle_bar  --> autoAlpha to 0

 

3)  #open_bottom_bar  --> morphs into #close_bottom_bar

 

Getting some errors in my console I don't understand that results in no morphing.

 

Uncaught TypeError: Cannot read property 'toUpperCase' of undefined

 

Doesn't give me a line number but I assume one or more of my selectors is returning null?

See the Pen eJMLrr by jstafford (@jstafford) on CodePen

Link to comment
Share on other sites

If you switch this:

tl = new TimelineMax();
tl.to($("#open_top_bar"), 1, {morphSVG:$("#close_top_bar")}, "+=1")
tl.to($("#open_middle_bar"), 1, {autoAlpha: 0}, "+=1")
tl.to($("#open_bottom_bar"), 1, {morphSVG:$("#close_bottom_bar")}, "+=1")

to this:

tl = new TimelineMax();
tl.to("#open_top_bar", 1, {morphSVG:"#close_top_bar"},0)
tl.to("#open_middle_bar", 1, {autoAlpha: 0}, 0)
tl.to("#open_bottom_bar", 1, {morphSVG:"#close_bottom_bar"}, 0);

everything is working just fine. :)

  • Like 2
Link to comment
Share on other sites

Yep, it had to do with the jQuery wrapper(s). We'll add some code to the next version to work around that. 

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