Looking for a way to match an IMG perspective with css properties (rotate 3D, Skew...). Here is my current image, and I Want my Div to fit the perspective of the screen. Sometimes I did it approximatively, but on windows Resize, everithing is messed up :(
Do you know how can I do It to keep it working even after a window resize and perfectly match ? Saw something about matrix, is it the good way ? Is there a tool to identify perspective on image ?
Thanks for help.
Here is exemple of my code. I'm using a Div for the exemple, but It will be a photo, so I need to have a real perspective
* {
box-sizing: border-box;
}
.surfacemockup {
width: 100%
}
.surfacecontainer {
width: 100%;
perspective: 8000px;
perspective-origin: 50% 50%;
margin: auto;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.perspectivesurface {
width: 100%;
height: 100%;
}
.photo-perspective {
width: 50%;
left: 32.3%;
height: 33.3%;
top: 24.3%;
display: flex;
position: absolute;
background: red;
transform-origin: top left;
transform: perspective(1000px) rotateX(0deg) rotateY(0deg) rotateZ(0deg) skewX(0deg) skewY(0deg);
}
<div class="surfacecontainer">
<div class="photo-perspective">
</div>
<img src="https://drive.lucasarts.fr/users/uploads/Match.JPG" class="surfacemockup">
</div>