perspective animated frames
by Alexandru Gatea
HTML
<ul>
<li>
<div class="card" style="background: url('http://lorempixel.com/80/120/nature/1')"><span class="s"></span></div>
</li>
<li>
<div class="card" style="background: url('http://lorempixel.com/80/120/nature/2')"><span class="s"></span></div>
<div class="card" style="background: url('http://lorempixel.com/80/120/nature/3')"><span class="s"></span></div>
</li>
<li>
<div class="card" style="background: url('http://lorempixel.com/80/120/nature/4')"><span class="s"></span></div>
<div class="card" style="background: url('http://lorempixel.com/80/120/nature/5')"><span class="s"></span></div>
</li>
<li>
<div class="card" style="background: url('http://lorempixel.com/80/120/nature/6')"><span class="s"></span></div>
<div class="card" style="background: url('http://lorempixel.com/80/120/nature/7')"><span class="s"></span></div>
</li>
<li>
<div class="card" style="background: url('http://lorempixel.com/80/120/nature/8')"><span class="s"></span></div>
</li>
</ul>
CSS
* {
margin: 0;
padding: 0;
}
body {
background: #000066;
position:absolute;
}
ul {
position: absolute;
width%100%;
top: 0;
left: 0;
perspective: 3000;
transform: rotateX(60deg) rotateZ(-50deg);
transform-style: preserve-3d;
width:480px;
}
ul li {
list-style: none;
display: block;
float: left;
padding: 5px;
transform-style: preserve-3d;
}
.card {
width: 80px;
height: 120px;
background: red;
margin-bottom: 10px;
box-shadow: -5px 8px 15px 5px rgba(0, 0, 0, 0.5);
position: relative;
}
ul li:nth-child(1) {
padding-top: 120px;
}
ul li:nth-child(2) {
padding-top: 40px;
}
ul li:nth-child(3) {
padding-top: 80px;
}
ul li:nth-child(4) {
padding-top: 10px;
}
ul li:nth-child(5) {
padding-top: 50px;
}
@keyframes MoveUpDown {
0% {
bottom: 0;
}
50% {
bottom: 10px;
}
100% {
bottom: 0;
}
}
@keyframes MoveDownUp {
0% {
bottom: 0;
}
50% {
bottom: -10px;
}
100% {
bottom: 0;
}
}
ul li:nth-child(1) .card {
animation: MoveDownUp 2s linear infinite;
}
ul li:nth-child(2) .card:first-child {
animation: MoveUpDown 2s linear infinite;
}
ul li:nth-child(2) .card:last-child {
animation: MoveDownUp 1s linear infinite;
}
ul li:nth-child(3) .card:first-child {
animation: MoveDownUp 3s linear infinite;
}
ul li:nth-child(3) .card:last-child {
animation: MoveDownUp 2s linear infinite;
}
ul li:nth-child(4) .card:first-child {
animation: MoveUpDown 2s linear infinite;
}
ul li:nth-child(4) .card:last-child {
animation: MoveDownUp 1s linear infinite;
}
ul li:nth-child(5) .card {
animation: MoveDownUp 2s linear infinite;
}