throbber animation
by Alexandru Gatea
HTML
<div id="throbber"></div>
<div class="throbber"></div>
SCSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
background-color:#212121;
background-image: url('https://www.seedinvest.com/wp-content/uploads/2014/12/1600x1200-new-york-city-skyline-wallpaper-black-and-white.jpg');
background-blend-mode: multiply;
}
#throbber,
.throbber {
display: block;
width: 100%;
height: 100vh;
position: fixed;
top: 0%;
left: 0%;
&:before,
&:after {
position: absolute;
content: "";
width: 50px;
height: 50px;
border-radius: 50%;
border: 10px solid;
left:50%;
top: 50%;
margin-top:-25px;
margin-left:-25px;
mix-blend-mode: screen;
background-blend-mode: screen;
}
}
#throbber {
animation: rotate 4s linear infinite ;
height: 100vh;
&:before {
background: rgba(198, 40, 40, 0.3);
border-color: rgba(198, 40, 40, 0.5);
animation: toBottom 2s ease-in-out infinite;
}
&:after {
background: rgba(255, 143, 0, 0.3);
border-color: rgba(255, 143, 0, 0.5);
animation: toTop 2s ease-in-out infinite;
}
}
.throbber {
animation: rotate 4s linear infinite;
&:before {
background: rgba(2, 119, 189, 0.3);
border-color: rgba(2, 119, 189, 0.5);
animation: toRight 2s ease-in-out infinite;
}
&:after {
background: rgba(85, 139, 47, 0.3);
border-color: rgba(85, 139, 47, 0.5);
animation: toLeft 2s ease-in-out infinite;
}
}
@keyframes toBottom {
0% {
transform:translateY(-50px);
}
50% {
transform:translateY(50px);
}
100% {
transform:translateY(-50px);
}
}
@keyframes toTop {
0% {
transform:translateY(50px);
}
50% {
transform:translateY(-50px);
}
100% {
transform:translateY(50px);
}
}
@keyframes toRight {
0% {
transform:translateX(-50px);
}
50% {
transform:translateX(50px);
}
100% {
transform:translateX(-50px);
...