<label class="loading">
<input type="checkbox">
<div>
<span>Loading...</span>
<span>Click for perspective</span>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</label>
<label class="loading">
<input type="checkbox" checked>
<div>
<span>Loading...</span>
<span>Click for perspective</span>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</label>
<a href="" class="restart">
<svg viewBox="0 0 16 16" fill="currentColor">
<path d="M4.5,4.5c1.9-1.9,5.1-1.9,7,0c0.7,0.7,1.2,1.7,1.4,2.7l2-0.3C14.7,5.4,14,4.1,13,3.1c-2.7-2.7-7.1-2.7-9.9,0 L0.9,0.9L0.2,7.3l6.4-0.7L4.5,4.5z"></path>
<path d="M15.8,8.7L9.4,9.4l2.1,2.1c-1.9,1.9-5.1,1.9-7,0c-0.7-0.7-1.2-1.7-1.4-2.7l-2,0.3 C1.3,10.6,2,11.9,3,12.9c1.4,1.4,3.1,2,4.9,2c1.8,0,3.6-0.7,4.9-2l2.2,2.2L15.8,8.7z"></path>
</svg>
Restart
</a>
<!-- dribbble - twitter -->
<a class="dribbble" href="https://dribbble.com/aaroniker" target="_blank"><img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" alt=""></a>
<a class="twitter" target="_blank" href="https://twitter.com/aaroniker_me"><svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72"><path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"></path></svg></a>
// could be messy a bit
.loading {
--load: 10000ms;
--border: #646B8C;
--background: #fff;
--background-perspective: #F6F8FF;
--active: #5C86FF;
margin: 52px 0;
& > div {
transform: perspective(var(--p)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
transition: transform .5s;
transform-style: preserve-3d;
position: relative;
cursor: pointer;
span {
display: block;
color: var(--c, #404660);
line-height: 23px;
font-size: var(--s, 16px);
font-weight: 500;
margin-bottom: 8px;
&:nth-child(2) {
--c: #BBC1E1;
--s: 14px;
position: absolute;
top: 100%;
left: 0;
margin-top: 8px;
}
}
ul {
width: 360px;
height: 36px;
margin: 0;
padding: 0;
list-style: none;
li {
--ry: 0deg;
--z: 0;
--x: 0;
position: absolute;
bottom: 0;
background: var(--b, var(--background));
border-top: 1px solid var(--border);
border-bottom: 1px solid var(--border);
width: var(--w, 200px);
left: var(--l, 0);
height: 36px;
transform: rotateY(var(--ry)) translateZ(var(--z)) translateX(var(--x));
transform-origin: 0 0;
&:before {
content: '';
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: var(--active);
transform-origin: var(--o, 0) 0;
transform: scaleX(0);
animation: fill var(--duration) linear forwards var(--delay);
}
&:nth-child(1) {
--delay: 0ms;
--duration: calc(var(--load) * calc(200 / 960));
border-left: 1px solid var(--border);
}
&:nth-child(2) {
--delay: calc(var(--load) * calc(200 / 960));
--duration: calc(var(--load) * calc(100 / 960));
--w: 100px;
--l: 200px;
--ry: 90deg;
--b: var(--background-perspective);
}
&:nth-child(3) {
--delay: calc(calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(100 / 960)));
--duration: calc(var(--load) * calc(32 / 960));
--w: 32px;
--l: 200px;
--z: -100px;
}
&:nth-child(4) {
--delay: calc(calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(32 / 960)));
--duration: calc(var(--load) * calc(100 / 960));
--w: 100px;
--l: 232px;
--ry: 90deg;
--o: 100%;
--b: var(--background-perspective);
}
&:nth-child(5) {
--delay: calc(calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(32 / 960)) + calc(var(--load) * calc(100 / 960)));
--duration: calc(var(--load) * calc(20 / 960));
--w: 20px;
--l: 232px;
}
&:nth-child(6) {
--delay: calc(calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(32 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(20 / 960)));
--duration: calc(var(--load) * calc(140 / 960));
--w: 140px;
--l: 252px;
--ry: 90deg;
--b: var(--background-perspective);
}
&:nth-child(7) {
--delay: calc(calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(32 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(20 / 960)) + calc(var(--load) * calc(140 / 960)));
--duration: calc(var(--load) * calc(24 / 960));
--w: 24px;
--l: 252px;
--z: -140px;
}
&:nth-child(8) {
--delay: calc(calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(32 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(20 / 960)) + calc(var(--load) * calc(140 / 960)) + calc(var(--load) * calc(24 / 960)));
--duration: calc(var(--load) * calc(200 / 960));
--w: 200px;
--l: 276px;
--ry: 90deg;
--x: -60px;
--o: 100%;
--b: var(--background-perspective);
}
&:nth-child(9) {
--delay: calc(calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(32 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(20 / 960)) + calc(var(--load) * calc(140 / 960)) + calc(var(--load) * calc(24 / 960)) + calc(var(--load) * calc(200 / 960)));
--duration: calc(var(--load) * calc(48 / 960));
--w: 48px;
--l: 276px;
--z: 60px;
}
&:nth-child(10) {
--delay: calc(calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(32 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(20 / 960)) + calc(var(--load) * calc(140 / 960)) + calc(var(--load) * calc(24 / 960)) + calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(48 / 960)));
--duration: calc(var(--load) * calc(60 / 960));
--w: 60px;
--l: 324px;
--ry: 90deg;
--x: -60px;
--b: var(--background-perspective);
}
&:nth-child(11) {
--delay: calc(calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(32 / 960)) + calc(var(--load) * calc(100 / 960)) + calc(var(--load) * calc(20 / 960)) + calc(var(--load) * calc(140 / 960)) + calc(var(--load) * calc(24 / 960)) + calc(var(--load) * calc(200 / 960)) + calc(var(--load) * calc(48 / 960)) + calc(var(--load) * calc(60 / 960)));
--duration: calc(var(--load) * calc(36 / 960));
--w: 36px;
--l: 324px;
border-right: 1px solid var(--border);
}
}
}
}
input {
display: none;
&:checked {
& + div {
--rx: -16deg;
--ry: -24deg;
--p: 600px;
}
}
}
}
@keyframes fill {
to {
transform: scaleX(1);
}
}
.restart {
display: table;
position: absolute;
bottom: 4%;
left: 50%;
transform: translateX(-50%);
text-decoration: none;
line-height: 23px;
color: #BBC1E1;
font-size: 14px;
font-weight: 500;
svg {
margin: 4px 4px 0 0;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: top;
}
}
html {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
}
* {
box-sizing: inherit;
&:before,
&:after {
box-sizing: inherit;
}
}
// Center & dribbble
body {
min-height: 100vh;
display: flex;
font-family: 'Roboto', Arial;
justify-content: center;
align-items: center;
flex-direction: column;
background: #F6F8FF;
.dribbble {
position: fixed;
display: block;
right: 20px;
bottom: 20px;
img {
display: block;
height: 28px;
}
}
.twitter {
position: fixed;
display: block;
right: 64px;
bottom: 14px;
svg {
width: 32px;
height: 32px;
fill: #1da1f2;
}
}
}
View Compiled
const $ = (s, o = document) => o.querySelector(s);
const $$ = (s, o = document) => o.querySelectorAll(s);
$('.restart').addEventListener('click', e => {
e.preventDefault();
$$('.loading').forEach(elem => {
elem.parentNode.replaceChild(elem.cloneNode(true), elem);
});
});
This Pen doesn't use any external JavaScript resources.