Jump to content

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

CSS "Clip-path" and Attribute "Inset" with GSAP

Recommended Posts

I got two issues when I want to use css "clip-path" and its attribute "inset".

The first one is I can't make it work as animation, I want it to move to Clip-path:inset(50% 0px 0px) slowly,

but it doesn't work.

The second one is I can't use something like Clip-path:inset (-50% 0px 0px),I want to use minus parameter,

but still not working

How can I make these work with GSAP?



See the Pen BdqyYy by Lannislot (@Lannislot) on CodePen

Link to comment
Share on other sites

Hello @Mio and Welcome to the GreenSock forum!


When i tested this in Firefox i did not see the image get clipped due to you just using webkitClipPath. You will also need to use clipPath for non webkit browsers like Firefox.  You will also notice that latest Chrome will use clipPath with no webkit vendor prefix. webkit-clip-path can be used along with clip-path to cover older and newer browsers, as well for older version of android chrome that require the webkit prefix. In some instances firefox can use webkit prefix but that is buggy. Its better just to use both and / or make sure to always include the standard clip-path property. Also make sure to remove any ending comma in your object so it doesn't trigger a JS parsing error.


var blockTween = new TweenMax.to("#img1", 1.00, { 
        delay: 2.25,
        webkitClipPath: 'inset(50% 0% 0%)',
        clipPath: 'inset(50% 0% 0%)'


See the Pen yoRMye by jonathan (@jonathan) on CodePen


Happy Tweening! :)

  • Like 4
Link to comment
Share on other sites

in addition to Jonathan's great advice, please see this on-official plugin @GreenSock created for the vendor pre-fixes on clipPath. As mentioned previously in that post clipPath is not currently a supported property.

  • Like 2
Link to comment
Share on other sites

Thank you, guys.
I know more about GSAP now and found something that I can try.

I may use SVG and change the attribute to do the same effect.

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.