Sukru Posted November 3, 2023 Posted November 3, 2023 Hello, I want to mask svg with scrolltrigger, but there is a problem in the code, I think it does not work. I want to bring the img from top to bottom, or from right to left, with an svg mask. Can you help me? See the Pen poGEmZP by sukruemanet (@sukruemanet) on CodePen.
mvaneijgen Posted November 4, 2023 Posted November 4, 2023 The image needs to be part of the SVG via the <image> tag https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image Or the SVG mask needs to be 1px by 1px, see following post https://davesmyth.com/clip-path-scaling If your mask is just a 'simple' shape it is much easier to use a CSS clip-path https://bennettfeely.com/clippy/ (make sure if you want to animate a clipPath that you animate between shapes that have the same amount of points and that all your values are suffixed with a '%' sign. Hope it helps and happy tweening! 1
Sukru Posted November 4, 2023 Author Posted November 4, 2023 @mvaneijgen hello again, i tried a few times but it works, can Codepen help via the link?
Solution mvaneijgen Posted November 4, 2023 Solution Posted November 4, 2023 I don't know what you're saying. I would just use a clip-path if your shape isn't to complex. You can just make your shapes with https://bennettfeely.com/clippy/ (make sure if you want to animate a clipPath that you animate between shapes that have the same amount of points and that all your values are suffixed with a '%' sign) See the Pen rNPWdQP?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen. 2
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