Skip to content

Instantly share code, notes, and snippets.

@russellhoff
Created October 4, 2022 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save russellhoff/c0657c0ba0a2b476dbd5e7de947040fe to your computer and use it in GitHub Desktop.
Save russellhoff/c0657c0ba0a2b476dbd5e7de947040fe to your computer and use it in GitHub Desktop.
SVG Loading Circle Animation
<div id="wrapper">
<div class="profile-main-loader">
<div class="loader">
<svg class="circular-loader"viewBox="25 25 50 50" >
<circle class="loader-path" cx="50" cy="50" r="20" fill="none" stroke="#70c542" stroke-width="2" />
</svg>
</div>
</div>
</div>
html,body{
height:100%;
}
#wrapper{
position:relative;
/*background:#333;*/
height:100%;
}
.profile-main-loader{
left: 50% !important;
margin-left:-100px;
position: fixed !important;
top: 50% !important;
margin-top: -100px;
width: 45px;
z-index: 9000 !important;
}
.profile-main-loader .loader {
position: relative;
margin: 0px auto;
width: 200px;
height:200px;
}
.profile-main-loader .loader:before {
content: '';
display: block;
padding-top: 100%;
}
.circular-loader {
-webkit-animation: rotate 2s linear infinite;
animation: rotate 2s linear infinite;
height: 100%;
-webkit-transform-origin: center center;
-ms-transform-origin: center center;
transform-origin: center center;
width: 100%;
position: absolute;
top: 0;
left: 0;
margin: auto;
}
.loader-path {
stroke-dasharray: 150,200;
stroke-dashoffset: -10;
-webkit-animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
stroke-linecap: round;
}
@-webkit-keyframes rotate {
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes rotate {
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-webkit-keyframes dash {
0% {
stroke-dasharray: 1,200;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 89,200;
stroke-dashoffset: -35;
}
100% {
stroke-dasharray: 89,200;
stroke-dashoffset: -124;
}
}
@keyframes dash {
0% {
stroke-dasharray: 1,200;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 89,200;
stroke-dashoffset: -35;
}
100% {
stroke-dasharray: 89,200;
stroke-dashoffset: -124;
}
}
@-webkit-keyframes color {
0% {
stroke: #70c542;
}
40% {
stroke: #70c542;
}
66% {
stroke: #70c542;
}
80%, 90% {
stroke: #70c542;
}
}
@keyframes color {
0% {
stroke: #70c542;
}
40% {
stroke: #70c542;
}
66% {
stroke: #70c542;
}
80%, 90% {
stroke: #70c542;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment