Jump to content
Search Community

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

Mio test
Moderator Tag

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

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?

 

Thanks

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

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