Document
by alvissqn
HTML
<div class="container">
<span style="--i:1"><img src="https://placehold.co/208x300" alt=""></span>
<span style="--i:2"><img src="https://placehold.co/208x300" alt=""></span>
<span style="--i:3"><img src="https://placehold.co/208x300" alt=""></span>
<span style="--i:4"><img src="https://placehold.co/208x300" alt=""></span>
<span style="--i:5"><img src="https://placehold.co/208x300" alt=""></span>
<span style="--i:6"><img src="https://placehold.co/208x300" alt=""></span>
<span style="--i:7"><img src="https://placehold.co/208x300" alt=""></span>
<span style="--i:8"><img src="https://placehold.co/208x300" alt=""></span>
</div>
CSS
body {
background-color: #1e272e;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
img {
height: 300px;
width: 208px;
object-fit:cover;
}
.container {
width: 208px;
height: 300px;
position: relative;
transform-style: preserve-3d;
transform: perspective(1000px);
animation: gallery 20s linear infinite;
cursor: pointer;
}
.container:hover{
animation-play-state: paused;
}
.container span {
position: absolute;
width: 100%;
height: 100%;
transform-style: preserve-3d;
transform: rotateY(calc(var(--i) * 45deg)) translateZ(300px);
--webkit-box-reflect: below 2.5px linear-gradient(transparent, transparent, rgba(3, 3, 3, 0.2));
}
.container span img {
position:absolute;
border-radius: 10px;
border: 6px ridge #ccc;
}
@keyframes gallery{
0%{
transform: perspective(1000px) rotateY(0deg);
}
100%{
transform: perspective(1000px) rotateY(360deg);
}
}