<div class="l-wrapper">
<ul class="rotation rotation--layers">
<li class="rotation__item item--1"></li>
<li class="rotation__item item--2"></li>
<li class="rotation__item item--3"></li>
<li class="rotation__item item--4"></li>
</ul>
<div class="progress"></div>
</div>
/* Change Image Animation
-------------------------------*/
$duration: 8s;
$max: 4;
$step: $duration/$max;
$step-perc: percentage(1/$max);
.rotation__item {
opacity: 0;
animation: hide $duration step-end infinite;
@for $item from 2 through $max {
&:nth-child(#{$max}n + #{$item}){
animation-delay: $step*($item - 1);
}
}
}
@keyframes hide {
0% {
opacity: 1;
}
#{$step-perc} {
opacity: .3;
}
}
/* Progress Bar
-------------------------------*/
.progress {
width: 0;
height: 5px;
margin-top: 3px;
background: rgba(154, 205, 50,.5);
animation: timer $duration infinite linear;
}
@keyframes timer {
100% {
width: 100%;
}
}
/* Common
-------------------------------*/
BODY {
background: #FFF linear-gradient(90deg, rgba(154, 205, 50,.3) 50%, rgba(154, 205, 50,.15) 50%);
background-size: 2em 2em;
perspective: 500px;
perspective-origin: center center;
}
.l-wrapper {
width: 95%;
margin: 0 auto;
transform-style: preserve-3d;
}
/* Demo layers
-------------------------------*/
$images: (
'http://static.colourlovers.com/images/patterns/3342/3342643.png',
'http://static.colourlovers.com/images/patterns/2617/2617226.png',
'http://static.colourlovers.com/images/patterns/3271/3271725.png',
'http://static.colourlovers.com/images/patterns/2617/2617452.png');
$rotation-height: 270px;
$max: length($images);
.rotation {
width: 100%;
height: $rotation-height;
&__item {
position: absolute;
width: 100%;
height: $rotation-height;
@for $item from 1 through $max {
&:nth-child(#{$max}n + #{$item}){
$img: nth($images, $item);
background: url(#{$img})
}
}
}
}
/* Show layers in 3D
-------------------------------*/
.rotation--layers {
@for $item from 1 through $max {
.item--#{$item} {
transform-origin: center bottom;
transform: rotateX(70deg) translateZ($rotation-height/$max * ($item - 1));
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.