Untitled fiddle
HTML
Hover the image to mirror it.
<div class="bg"></div>
CSS
.bg {
width: 500px;
height: 500px;
background-image: var(--url);
image-orientation: none;
&:hover {
image-orientation: from-image;
}
}
JavaScript
// image-orientation requires same-origin, and we can't do cross-origin requests with CSS bg-image yet...
// So for demo only we need to load it through JS, but on your porject you can use a same-origin iamge directly
const url = "https://i.sstatic.net/MLQzoMpB.jpg"
fetch(url)
.then(r => r.blob())
.then(b => document.body.style.setProperty("--url", `url(${URL.createObjectURL(b)})`))
.catch(console.error)