I'm trying to animate an element being cut like this
but I can't figure out how to do it. I tried doing it with transparent gradient mask and shifting the position, but I couldn't make the element visible fully, only either bottom or top half of it.
.el {
mask-image: linear-gradient(to bottom, transparent 50%, white 50%);
mask-position-y: 0.5em;
mask-repeat: no-repeat;
transition: mask-position 250ms ease;
}
The text is 1em high, and when the mask position is set to -0.5em the bottom half is cut, and when 0.5em the top half is cut. Also, I need the original box to remain visible and the same dimensions to not break the overall layout. Is there a solution for this or an entirely different method? In vanilla CSS, preferably no JS, but I do have JQuery.