I am looking to create a unique animation effect for the image shown below. My goal is to split the picture diagonally from the top left to the bottom right, a few pixels apart along the X axis.
Although I have made some progress by duplicating the same image and skewing them on the X axis, the split currently occurs from the top right to the bottom left. I need assistance in achieving the desired diagonal split orientation.
In addition, I am struggling to implement an animation that triggers when hovering over the entire image, causing both sides to split and return to their original state upon mouse movement.
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>
My vision is for the image to split into two halves along the middle diagonal line (from top left to bottom right) upon hover, and seamlessly merge back together upon mouse exit.