Jump to content
Search Community

GSAP unable to animate clip-path: polygon with calc percent + px units

bradwoods.io
Moderator Tag

Recommended Posts

bradwoods.io
Posted

I've seen sandboxes of GSAP animating polygon but none with calc using percent + px units. Does anyone know if I'm implementing this incorrectly or if not, a workaround for this? Sandbox: 

See the Pen BaEZorO?editors=0110 by bradwoods (@bradwoods) on CodePen.

  • bradwoods.io changed the title to GSAP unable to animate clip-path: polygon with calc percent + px units
Posted

That's because your starting and ending strings have different amounts of numbers and are formatted differently, thus the complex string animation can't function the way you expected. 

 

There are two pretty easy solutions: 

 

1) Just make sure the start/end strings have matching formatting and quantity of numbers: 

See the Pen OJGgXRQ?editors=0010 by GreenSock (@GreenSock) on CodePen.

 

2) Use a CSS variable to simplify things: 

See the Pen GRLEqNO by GreenSock (@GreenSock) on CodePen.

 

Does that clear things up? 

  • Like 1

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