Jump to content
Search Community

svg morph beginner question

jstafford test
Moderator Tag

Go to solution Solved by PointC,

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

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

  • Solution

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

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