Vinay Raj Posted September 10 Posted September 10 Hi, I am trying to apply a mask/clip path on the wings so that when the wings are moving, the portion of the wings that go behind the hair, ears and bottom of the boy's body is masked and cannot be seen. If I apply the same mask /clippath to an svg path which has no gsap tweening (such as the boy's body), it works fine but when applying to svg paths such as wings that tween, I see that the mask is not applied at all / not applied properly. I have shown the masking area in grey for reference. When wings move out of the grey area, they must not be visible. Unable to find any solution. Appreciate any help! See the Pen WbQBQKq by kvtqecwj-the-reactor (@kvtqecwj-the-reactor) on CodePen.
Solution GreenSock Posted September 11 Solution Posted September 11 You were applying a clip-path to the wrong thing - I think you meant to wrap your elements in a <g> that has it applied so that the wings can move inside the masked element. Otherwise, you're just moving the pixels that are already clipped. I increased the angle of the wings so you can more clearly see the clipping - is this what you're looking for?: See the Pen dPYEGPj?editors=1010 by GreenSock (@GreenSock) on CodePen. 1
Vinay Raj Posted September 11 Author Posted September 11 Thank you for the prompt response. Yes this is exactly what I am looking for. I dont fully understand why defining the clip path in a <g> solves the issue but yes glad it works. Thank you very much!
GreenSock Posted September 11 Posted September 11 15 hours ago, Vinay Raj said: Thank you for the prompt response. Yes this is exactly what I am looking for. I dont fully understand why defining the clip path in a <g> solves the issue but yes glad it works. Thank you very much! Think of it as if the element you're clipping gets clipped FIRST and then you're just moving those clipped pixels around (as if that's the entire element - the clipped pixels). But what you're actually wanting is for the PARENT to get clipped so that the elements inside the clipped parent can move around inside the clipped container.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now