Looking for assistance in creating a spinner using only CSS that resembles the image provided, with only one section of the spinner colored at a time.
In this code snippet, there is a similar spinner but I need to rotate the entire spinner by 22.5° and make modifications to its rays.
HTML:
<div class="spinner"><div>Loading…</div></div>
CSS:
@-webkit-keyframes spin {
to { transform: rotate(1turn); }
}
@-moz-keyframes spin {
to { transform: rotate(1turn); }
}
@-ms-keyframes spin {
to { transform: rotate(1turn); }
}
@keyframes spin {
to { transform: rotate(1turn); }
}
.spinner {
position: relative;
display: inline-block;
width: 5em;
height: 5em;
margin: 0 .5em;
font-size: 12px;
text-indent: 999em;
overflow: hidden;
-webkit-animation: spin 0.8s infinite steps(8);
-moz-animation: spin 0.8s infinite steps(8);
-ms-animation: spin 0.8s infinite steps(8);
-o-animation: spin 0.8s infinite steps(8);
animation: spin 0.8s infinite steps(8);
}
.spinner:before,
.spinner:after,
.spinner > div:before,
.spinner > div:after {
content: '';
position: absolute;
top: 0;
left: 2.25em; /* (container width - part width)/2 */
width: .5em;
height: 1.5em;
border-radius: .2em;
background: #eee;
box-shadow: 0 3.5em #eee; /* container height - part height */
transform-origin: 50% 2.5em; /* container height / 2 */
}
.spinner:before {
background: blue;
}
.spinner:after {
transform: rotate(-45deg);
}
.spinner > div:before {
transform: rotate(-90deg);
}
.spinner > div:after {
transform: rotate(-135deg);
}
Any help would be greatly appreciated!