Circular loader (using linear-gradient, pseudo-element and span)
by Konstantin Rouda
HTML
<div class="loader">
<div class="loader-helper loader--fail">
<div class="sign">
<span class="border-helper border-helper--bottom"></span>
<span class="border-helper border-helper--right"></span>
</div>
</div>
</div>
CSS
HTML {
font-size: 100%;
line-height: 1.5;
font-family: "Droid Sans", "Open Sans", sans-serif;
box-sizing: border-box;
}
BODY {
display: flex;
flex-flow: column wrap;
margin: 0;
color: rgb(81, 85, 88);
min-height: 100vh;
background: rgb(244, 235, 236) url(http://imgh.us/cactus-sm.jpg) no-repeat;
//background: rgba(76, 68, 69, 0.68) url(http://imgh.us/cactus-sm.jpg) no-repeat;
background-position: calc(100% + 203px) bottom; /*203px - half width of the image*/
}
*, *::before, *::after {
box-sizing: inherit;
color: inherit;
}
.loader {
position: relative;
width: 300px;
height: 300px;
margin: 2em auto 0;
background-color: rgb(234, 225, 226);
//background-color: rgba(128, 124, 125, 1);
//background-color: rgb(200, 250, 250);
background-image: linear-gradient(to right, transparent 50%, indianred 0);
color: transparent;
border-radius: 50%;
overflow: hidden;
transform: scale(0);
//box-shadow: 0px 2px 4px rgba(20, 20, 20, .3);
text-align: center;
animation: loader-appear 1s ease-in-out 1 forwards;
}
@keyframes loader-appear {
50% { transform: scale(1.2); }
100% { transform: scale(1); }
}
.loader::before {
content: "";
position: absolute;
top: 0; left: 50%;
width: 50%; height: 100%;
border-radius: 0 100% 100% 0 / 50%;
background-color: inherit;
transform-origin: left;
animation: loader-spin 3s linear 2, loader-bg 6s step-end 1;
animation-fill-mode: forwards;
}
.loader-helper {
content: "";
position: absolute;
top: 50%; left: 50%;
width: 95%; height: 95%;
border-radius: 50%;
transform: translate(-50%, -50%);
background-color: inherit;
text-align: center;
}
@keyframes loader-spin {
100% { transform: rotate(.5turn); }
}
@keyframes loader-bg {
50%, 100% { background: indianred; }
}
.sign {
position: relative;
display: inline-block;
width: 65px;
height: 100px;
margin: 20% auto;
transform: rotate(45deg);
}
.border-helper {
position: absolute;
...