Jump to content
Search Community

Dragable and image clip

Sagi Karni 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

Hi , 

I would approciate if you could help with the following scenario.

I would like yo use a dragable object (lets assume a rectangle ) on top of an image (or any div with a background image) which is completely hidden exept

the arae inside this dragable object (e.g. "Drag me"). The drag expirience should be as the following codepen demo

The attached image illustrate how the image looks like and how it should look like when the only part that is not hidden is the dragable object area.






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





Link to comment
Share on other sites

Hi @Sagi Karni:)


Welcome to the forum. 


If I understand your question correctly, you want the draggable element to reveal just a small section of the underlying image? If it were me, I'd use a SVG so it scales nicely and then use a clip-path. Something like this maybe:


See the Pen eVqgyj by PointC (@PointC) on CodePen


I used a second copy of the image with a 25% opacity just so it's easier to see what's happening. Hopefully that helps. Happy tweening.





  • Like 3
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...