Last active
December 4, 2019 15:17
-
-
Save peacefullatom/8a02fc0bef6732a3e6e6e8129d7666d7 to your computer and use it in GitHub Desktop.
Pseudo 3D preloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<style> | |
html, | |
body, | |
.container { | |
width: 100%; | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
} | |
.spinner { | |
--size: 30vmin; | |
--border-color: #ff3333ff; | |
--delay: 0.9s; | |
width: var(--size); | |
height: var(--size); | |
animation-name: rotate; | |
animation-duration: calc(var(--delay) * 3); | |
animation-timing-function: ease-in-out; | |
animation-iteration-count: infinite; | |
border: 4vmin solid transparent; | |
border-radius: 50%; | |
border-top-color: var(--border-color); | |
border-bottom-color: var(--border-color); | |
box-sizing: border-box; | |
position: absolute; | |
z-index: 3; | |
} | |
.spinner.two { | |
--border-color: #ffff33ff; | |
animation-delay: var(--delay); | |
z-index: 2; | |
} | |
.spinner.three { | |
--border-color: #33ff33ff; | |
animation-delay: calc(var(--delay) * 2); | |
z-index: 1; | |
} | |
@keyframes rotate { | |
0% { | |
transform: rotate3d(0, 0, 0, 0deg); | |
z-index: 3; | |
} | |
50% { | |
z-index: 2; | |
} | |
100% { | |
transform: rotate3d(1, 1, 1, 360deg); | |
z-index: 1; | |
} | |
} | |
</style> | |
<div class="container"> | |
<div class="spinner"></div> | |
<div class="spinner two"></div> | |
<div class="spinner three"></div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment