JSFiddle - React, Tailwind, and code Playground
by Amal Das
HTML
<div class="loader-item">
<div class="loader loader-1"></div>
</div>
CSS
html, body {
width: 100%;
height: 100%;
display: flex;
font-family: "Delius Unicase", cursive;
}
.loader {
width: 30px;
height: 30px;
position: relative;
margin: auto;
}
.loader-1::before {
border-style: solid;
border-width: 3px 3px 3px 0;
border-color: rgb(31, 105, 255) transparent transparent;
transform: scale(0.3) rotate(
0deg
);
opacity: 0.5;
-webkit-animation-name: foregroundCircle;
animation-name: foregroundCircle;
}
.loader-1::after {
background: #fff;
opacity: 0.5;
transform: scale(0);
-webkit-animation-name: backgroundCircle;
animation-name: backgroundCircle;
}
.loader-1::before, .loader-1::after {
border-radius: 50%;
width: 100%;
height: 100%;
top: calc(50% - 15px);
left: calc(50% - 15px);
-webkit-animation-duration: 3s;
animation-duration: 3s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.loader::after {
content: "";
position: absolute;
}
@keyframes foregroundCircle{
0%
{transform: scale(0.3) rotate(0deg);}
12.5%
{transform: scale(0.3) rotate(180deg);}
25%, 50%
{opacity: 1;}
50%
{transform: scale(1) rotate(720deg);}
100%
{transform: scale(0.3) rotate(1800deg);
opacity: 0.5;}
}