hey you two! 🌻
during my research i learned the following.
i hope this explains it a little better and maybe it can help somebody else in the future.
since i’m not rendering the svg visually, but using it solely for a clip path applied to html elements, the viewbox doesn’t play a role in determining the size or position of the clipping area. the same rule applies when setting a size (width, height) or position (x, y) for the svg. in this specific use case, these things have no effect. the svg is merely a container for the clip path definition. instead, the css transformations applied to the #mask element are what actually determine its final size and position.
one more thing worth mentioning is the clipPathUnits attribute, which is currently set to userSpaceOnUse (browser default). there are some big advantages in using it over the more commonly used objectBoundingBox. because it allows to keep the aspect ratio of the text and target its size, position and other properties via css. i have created another pen to show the difference in action (again, difference between chrome and safari/firefox).
userSpaceOnUse
the coordinate system for the clip path will be the same as the svg's coordinate system. however, since i’m positioning and scaling the clip path using css, this setting will effectively let my css styles dictate the final size and position.
objectBoundingBox
the coordinate system for the clip path will be scaled and positioned to fit within the bounding box of each individual element that uses the clip path. in my setup, this would mean that the coordinate system for the clip path would adjust to the dimensions of my slides. values like x, y, width, heigh and font-size within the clip path would be interpreted as fractions (0 - 1) of the slide’s bounding box.
----
so to summarise, @Rodrigo i don’t know if using svgOrigin would have any effect in my use case, as i am not using the svg’s global coordinate space. and @SteveS that was a great catch. yes, i can confirm changing transformOrigin to 50% 50% will indeed fix the issue in safari & firefox. however, i would still like to understand why. do you have any idea?
i would love to find a universal solution and only as a plan b build workarounds for specific browsers. however, if i need to go this route.. are there any built-in tools within gsap to check for that?
thank you all!
🪲 ✨
https://codepen.io/jaro_io/pen/rNoYLep