I have the picture below to which I would like to animate a diagonal split from the line cut through the logo from the top left to bottom right as shown below. The animation would split the picture on the X axis a few pixels apart.
https://i.ibb.co/fDzZ6Sc/Logo.png
I have made some progress so far, I used the same picture twice and laid them over each other and skewed on the X axis. However this split the picture apart from the top right to bottom left. I like it the other way around and can't figure it out.
I also could not figure out how to hover over the whole picture for the animation to execute for both of the sides.
body { background: gainsboro; }
.pageOption {
overflow: hidden;
position: relative;
margin: 0 auto;
width: 40em; height: 27em;
}
.option, .option img { width: 100%; height: 100%; }
.option {
overflow: hidden;
position: absolute;
/* arctan(27 / 40) = 34.01935deg
* need to skew by 90deg - 34.01935deg = 55.98065deg
*/
transform: skewX(-55.98deg);
}
.option:first-child {
left: -.25em;
transform-origin: 100% 0;
}
.option:last-child {
right: -.25em;
transform-origin: 0 100%;
}
.option img, .option:after {
transform: skewX(55.98deg);
transform-origin: inherit;
}
.option:hover {
left: -.8em;
transition: 1s;
}
<div class='pageOption'>
<a href='#' class='option'>
<img src='https://i.ibb.co/fDzZ6Sc/Logo.png'>
</a>
<a href='#' class='option'>
<img src='https://i.ibb.co/fDzZ6Sc/Logo.png'>
</a>
</div>
Essentially what I would like to happen is upon hovering on the whole picture, the two sides would split from the middle (cut from the line going from top left to bottom right), and when you move your mouse off, for the image to go back together.