JSFiddle - React, Tailwind, and code Playground

by Federico Tibaldo

HTML

<div class="parent">
    <div class='slide'>
        <div></div>
    </div>
    <div class='slide'>
        <div></div>
    </div>
</div>

CSS

html, body {
    width: 100%;
    height: 100%;
    overflow:hidden;
}
.parent {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 250px;
    -webkit-perspective: 250px;
}
.slide {
    position:absolute;
    width:100%;
    height:100%;
    background:black;
    -webkit-transform-origin: bottom center;
    transform-origin: bottom center;
}
.slide div {
    position:absolute;
    width:30%;
    height:30%;
    background:white;
    border-radius:50%;
    top:50%;
    left:50%;
    margin-top:-15%;
    margin-left:-15%;
}
.slide:nth-of-type(1) {
    background:white;
}
.slide:nth-of-type(1) div {
    background:black;
}
.slide:nth-of-type(2) {
    -webkit-animation:slide 4s ease-out infinite;
    animation:slide 4s ease-in-out infinite;
}
@-webkit-keyframes slide {
    25% {
        -webkit-transform: rotateY(30deg);
    }
    50%, 100% {
        -webkit-transform: rotateX(30deg) translateY(100%);
    }
}
@keyframes slide {
    25% {
        transform: rotateY(30deg);
    }
    50%, 100% {
        transform: rotateX(30deg) translateY(100%);
    }
}