Jump to content
GreenSock

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

Scaling SVG clip-path from the center?

Recommended Posts

Hey all, I'm having an issue using GSAP to scale an SVG path and clip-path element.

 

The path is scaling relative to the center (which is what I'm looking for) but the clip-path is scaling relative to the top left of the the element. At first I thought it might have been an issue with "normalizing" the SVG path to fit into a viewbox with value "0 0 1 1" but that doesn't seem to be the case. (I've commented out the normalized path at the top of the file, which gives the same result).

 

I've tried a few values for transformOrigin, including "50% 50%" and "center" and "center center" lol

 

Is scaling relative to the center for clip-paths possible?


Thanks!

 

See the Pen PoKgEGE by carterduong (@carterduong) on CodePen

Link to comment
Share on other sites

Welcome to the forums @cartercarter

 

clipPaths aren't rendered, so you you can't animate them like a normal graphics element. To animate a clipPath, you have to animate what's inside of it, kind of like this.

 

See the Pen BadeJqV by GreenSock (@GreenSock) on CodePen

 

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