Jump to content
Search Community

SVG Mask & motionPath Plugin #help

bryanballi
Moderator Tag

Recommended Posts

Posted

Hello!


I am working to reveal this shape/outline via a mask ...specifically the rectangle shape, as it animates via motionPath the shape should reveal. This pen is set up to show the rectangle animating along its path (.path2) successfully, but when I place it within a mask ("theSquare"), motionPath breaks. Commenting in <defs> and <mask> within the linked pen will replicate the error.

 

Can you help me understand why this is happening? 


Thank You!

See the Pen xxZJgYd by bai-ee (@bai-ee) on CodePen.

ZachSaucier
Posted

Hey Bryan and welcome to the GreenSock forums. If you open up the dev tools console you can see an error that says "Uncaught TypeError: t.getBBox is not a function". 

 

Using #theSquare instead of the containing <g> element seems to fix the issue: 

See the Pen XWXBZqw?editors=1000 by GreenSock (@GreenSock) on CodePen.

 

Side note: We don't recommend having any transforms on elements that you're animating with GSAP outside of GSAP. The most common mistakes article explains why.

Posted

Thank you for both pieces of insight! 

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