Skip to content

Instantly share code, notes, and snippets.

@proxymoron
Created July 25, 2015 01:12
Show Gist options
  • Select an option

  • Save proxymoron/03ea1410ed8ae883da4f to your computer and use it in GitHub Desktop.

Select an option

Save proxymoron/03ea1410ed8ae883da4f to your computer and use it in GitHub Desktop.
SVG Preloaders
<!-- Preloader 1 -->
<svg version="1.1" id="preloader1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140px" height="140px"
viewBox="0 0 200 200">
<g class="pre load1">
<path fill="#1B1A1C" d="M124.5,57L124.5,57c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7v0c0-3.9,3.1-7,7-7h36
C121.4,50,124.5,53.1,124.5,57z"/>
<path fill="#1B1A1C" d="M147.7,86.9L147.7,86.9c-2.7,2.7-7.2,2.7-9.9,0l-25.5-25.5c-2.7-2.7-2.7-7.2,0-9.9l0,0
c2.7-2.7,7.2-2.7,9.9,0L147.7,77C150.5,79.8,150.5,84.2,147.7,86.9z"/>
<path fill="#1B1A1C" d="M143,74.5L143,74.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7l0,0c-3.9,0-7-3.1-7-7v-36
C136,77.6,139.1,74.5,143,74.5z"/>
<path fill="#1B1A1C" d="M148.4,112.4L148.4,112.4c2.7,2.7,2.7,7.2,0,9.9L123,147.7c-2.7,2.7-7.2,2.7-9.9,0h0c-2.7-2.7-2.7-7.2,0-9.9
l25.5-25.5C141.3,109.6,145.7,109.6,148.4,112.4z"/>
<path fill="#1B1A1C" d="M125.5,143L125.5,143c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7l0,0c0-3.9,3.1-7,7-7h36 C122.4,136,125.5,139.1,125.5,143z"/>
<path fill="#1B1A1C" d="M52.3,113.1L52.3,113.1c2.7-2.7,7.2-2.7,9.9,0l25.5,25.5c2.7,2.7,2.7,7.2,0,9.9h0c-2.7,2.7-7.2,2.7-9.9,0
L52.3,123C49.5,120.2,49.5,115.8,52.3,113.1z"/>
<path fill="#1B1A1C" d="M57,75.5L57,75.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7h0c-3.9,0-7-3.1-7-7v-36C50,78.6,53.1,75.5,57,75.5z"/>
<path fill="#1B1A1C" d="M86.9,52.3L86.9,52.3c2.7,2.7,2.7,7.2,0,9.9L61.5,87.6c-2.7,2.7-7.2,2.7-9.9,0l0,0c-2.7-2.7-2.7-7.2,0-9.9
L77,52.3C79.8,49.5,84.2,49.5,86.9,52.3z"/>
</g>
</svg>
<!-- Preloader 2 -->
<svg version="1.1" id="preloader2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140px" height="140px"
viewBox="0 0 200 200">
<g class="pre load2">
<path fill="#1B1A1C" d="M124.5,57L124.5,57c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7v0c0-3.9,3.1-7,7-7h36
C121.4,50,124.5,53.1,124.5,57z"/>
<path fill="#1B1A1C" d="M147.7,86.9L147.7,86.9c-2.7,2.7-7.2,2.7-9.9,0l-25.5-25.5c-2.7-2.7-2.7-7.2,0-9.9l0,0
c2.7-2.7,7.2-2.7,9.9,0L147.7,77C150.5,79.8,150.5,84.2,147.7,86.9z"/>
<path fill="#1B1A1C" d="M143,74.5L143,74.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7l0,0c-3.9,0-7-3.1-7-7v-36
C136,77.6,139.1,74.5,143,74.5z"/>
<path fill="#1B1A1C" d="M148.4,112.4L148.4,112.4c2.7,2.7,2.7,7.2,0,9.9L123,147.7c-2.7,2.7-7.2,2.7-9.9,0h0c-2.7-2.7-2.7-7.2,0-9.9
l25.5-25.5C141.3,109.6,145.7,109.6,148.4,112.4z"/>
<path fill="#1B1A1C" d="M125.5,143L125.5,143c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7l0,0c0-3.9,3.1-7,7-7h36 C122.4,136,125.5,139.1,125.5,143z"/>
<path fill="#1B1A1C" d="M52.3,113.1L52.3,113.1c2.7-2.7,7.2-2.7,9.9,0l25.5,25.5c2.7,2.7,2.7,7.2,0,9.9h0c-2.7,2.7-7.2,2.7-9.9,0
L52.3,123C49.5,120.2,49.5,115.8,52.3,113.1z"/>
<path fill="#1B1A1C" d="M57,75.5L57,75.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7h0c-3.9,0-7-3.1-7-7v-36C50,78.6,53.1,75.5,57,75.5z"/>
<path fill="#1B1A1C" d="M86.9,52.3L86.9,52.3c2.7,2.7,2.7,7.2,0,9.9L61.5,87.6c-2.7,2.7-7.2,2.7-9.9,0l0,0c-2.7-2.7-2.7-7.2,0-9.9
L77,52.3C79.8,49.5,84.2,49.5,86.9,52.3z"/>
</g>
</svg>
<!-- Preloader 3 -->
<svg version="1.1" id="preloader3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140px" height="140px"
viewBox="0 0 200 200">
<g class="pre load3">
<path fill="#1B1A1C" d="M124.5,57L124.5,57c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7v0c0-3.9,3.1-7,7-7h36
C121.4,50,124.5,53.1,124.5,57z"/>
<path fill="#1B1A1C" d="M147.7,86.9L147.7,86.9c-2.7,2.7-7.2,2.7-9.9,0l-25.5-25.5c-2.7-2.7-2.7-7.2,0-9.9l0,0
c2.7-2.7,7.2-2.7,9.9,0L147.7,77C150.5,79.8,150.5,84.2,147.7,86.9z"/>
<path fill="#1B1A1C" d="M143,74.5L143,74.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7l0,0c-3.9,0-7-3.1-7-7v-36
C136,77.6,139.1,74.5,143,74.5z"/>
<path fill="#1B1A1C" d="M148.4,112.4L148.4,112.4c2.7,2.7,2.7,7.2,0,9.9L123,147.7c-2.7,2.7-7.2,2.7-9.9,0h0c-2.7-2.7-2.7-7.2,0-9.9
l25.5-25.5C141.3,109.6,145.7,109.6,148.4,112.4z"/>
<path fill="#1B1A1C" d="M125.5,143L125.5,143c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7l0,0c0-3.9,3.1-7,7-7h36 C122.4,136,125.5,139.1,125.5,143z"/>
<path fill="#1B1A1C" d="M52.3,113.1L52.3,113.1c2.7-2.7,7.2-2.7,9.9,0l25.5,25.5c2.7,2.7,2.7,7.2,0,9.9h0c-2.7,2.7-7.2,2.7-9.9,0
L52.3,123C49.5,120.2,49.5,115.8,52.3,113.1z"/>
<path fill="#1B1A1C" d="M57,75.5L57,75.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7h0c-3.9,0-7-3.1-7-7v-36C50,78.6,53.1,75.5,57,75.5z"/>
<path fill="#1B1A1C" d="M86.9,52.3L86.9,52.3c2.7,2.7,2.7,7.2,0,9.9L61.5,87.6c-2.7,2.7-7.2,2.7-9.9,0l0,0c-2.7-2.7-2.7-7.2,0-9.9
L77,52.3C79.8,49.5,84.2,49.5,86.9,52.3z"/>
</g>
</svg>
<br>
<!-- Preloader 4 -->
<svg version="1.1" id="preloader4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140px" height="140px"
viewBox="0 0 200 200">
<g class="pre load4">
<path fill="#1B1A1C" d="M124.5,57L124.5,57c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7v0c0-3.9,3.1-7,7-7h36
C121.4,50,124.5,53.1,124.5,57z"/>
<path fill="#1B1A1C" d="M147.7,86.9L147.7,86.9c-2.7,2.7-7.2,2.7-9.9,0l-25.5-25.5c-2.7-2.7-2.7-7.2,0-9.9l0,0
c2.7-2.7,7.2-2.7,9.9,0L147.7,77C150.5,79.8,150.5,84.2,147.7,86.9z"/>
<path fill="#1B1A1C" d="M143,74.5L143,74.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7l0,0c-3.9,0-7-3.1-7-7v-36
C136,77.6,139.1,74.5,143,74.5z"/>
<path fill="#1B1A1C" d="M148.4,112.4L148.4,112.4c2.7,2.7,2.7,7.2,0,9.9L123,147.7c-2.7,2.7-7.2,2.7-9.9,0h0c-2.7-2.7-2.7-7.2,0-9.9
l25.5-25.5C141.3,109.6,145.7,109.6,148.4,112.4z"/>
<path fill="#1B1A1C" d="M125.5,143L125.5,143c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7l0,0c0-3.9,3.1-7,7-7h36 C122.4,136,125.5,139.1,125.5,143z"/>
<path fill="#1B1A1C" d="M52.3,113.1L52.3,113.1c2.7-2.7,7.2-2.7,9.9,0l25.5,25.5c2.7,2.7,2.7,7.2,0,9.9h0c-2.7,2.7-7.2,2.7-9.9,0
L52.3,123C49.5,120.2,49.5,115.8,52.3,113.1z"/>
<path fill="#1B1A1C" d="M57,75.5L57,75.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7h0c-3.9,0-7-3.1-7-7v-36C50,78.6,53.1,75.5,57,75.5z"/>
<path fill="#1B1A1C" d="M86.9,52.3L86.9,52.3c2.7,2.7,2.7,7.2,0,9.9L61.5,87.6c-2.7,2.7-7.2,2.7-9.9,0l0,0c-2.7-2.7-2.7-7.2,0-9.9
L77,52.3C79.8,49.5,84.2,49.5,86.9,52.3z"/>
</g>
</svg>
<!-- Preloader 5 -->
<svg version="1.1" id="preloader5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140px" height="140px"
viewBox="0 0 200 200">
<g class="pre load5">
<path fill="#1B1A1C" d="M124.5,57L124.5,57c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7v0c0-3.9,3.1-7,7-7h36
C121.4,50,124.5,53.1,124.5,57z"/>
<path fill="#1B1A1C" d="M147.7,86.9L147.7,86.9c-2.7,2.7-7.2,2.7-9.9,0l-25.5-25.5c-2.7-2.7-2.7-7.2,0-9.9l0,0
c2.7-2.7,7.2-2.7,9.9,0L147.7,77C150.5,79.8,150.5,84.2,147.7,86.9z"/>
<path fill="#1B1A1C" d="M143,74.5L143,74.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7l0,0c-3.9,0-7-3.1-7-7v-36
C136,77.6,139.1,74.5,143,74.5z"/>
<path fill="#1B1A1C" d="M148.4,112.4L148.4,112.4c2.7,2.7,2.7,7.2,0,9.9L123,147.7c-2.7,2.7-7.2,2.7-9.9,0h0c-2.7-2.7-2.7-7.2,0-9.9
l25.5-25.5C141.3,109.6,145.7,109.6,148.4,112.4z"/>
<path fill="#1B1A1C" d="M125.5,143L125.5,143c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7l0,0c0-3.9,3.1-7,7-7h36 C122.4,136,125.5,139.1,125.5,143z"/>
<path fill="#1B1A1C" d="M52.3,113.1L52.3,113.1c2.7-2.7,7.2-2.7,9.9,0l25.5,25.5c2.7,2.7,2.7,7.2,0,9.9h0c-2.7,2.7-7.2,2.7-9.9,0
L52.3,123C49.5,120.2,49.5,115.8,52.3,113.1z"/>
<path fill="#1B1A1C" d="M57,75.5L57,75.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7h0c-3.9,0-7-3.1-7-7v-36C50,78.6,53.1,75.5,57,75.5z"/>
<path fill="#1B1A1C" d="M86.9,52.3L86.9,52.3c2.7,2.7,2.7,7.2,0,9.9L61.5,87.6c-2.7,2.7-7.2,2.7-9.9,0l0,0c-2.7-2.7-2.7-7.2,0-9.9
L77,52.3C79.8,49.5,84.2,49.5,86.9,52.3z"/>
</g>
</svg>
<!-- Preloader 6 -->
<svg version="1.1" id="preloader6" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140px" height="140px"
viewBox="0 0 200 200">
<g class="pre load6">
<path fill="#1B1A1C" d="M124.5,57L124.5,57c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7v0c0-3.9,3.1-7,7-7h36
C121.4,50,124.5,53.1,124.5,57z"/>
<path fill="#1B1A1C" d="M147.7,86.9L147.7,86.9c-2.7,2.7-7.2,2.7-9.9,0l-25.5-25.5c-2.7-2.7-2.7-7.2,0-9.9l0,0
c2.7-2.7,7.2-2.7,9.9,0L147.7,77C150.5,79.8,150.5,84.2,147.7,86.9z"/>
<path fill="#1B1A1C" d="M143,74.5L143,74.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7l0,0c-3.9,0-7-3.1-7-7v-36
C136,77.6,139.1,74.5,143,74.5z"/>
<path fill="#1B1A1C" d="M148.4,112.4L148.4,112.4c2.7,2.7,2.7,7.2,0,9.9L123,147.7c-2.7,2.7-7.2,2.7-9.9,0h0c-2.7-2.7-2.7-7.2,0-9.9
l25.5-25.5C141.3,109.6,145.7,109.6,148.4,112.4z"/>
<path fill="#1B1A1C" d="M125.5,143L125.5,143c0,3.9-3.1,7-7,7h-36c-3.9,0-7-3.1-7-7l0,0c0-3.9,3.1-7,7-7h36 C122.4,136,125.5,139.1,125.5,143z"/>
<path fill="#1B1A1C" d="M52.3,113.1L52.3,113.1c2.7-2.7,7.2-2.7,9.9,0l25.5,25.5c2.7,2.7,2.7,7.2,0,9.9h0c-2.7,2.7-7.2,2.7-9.9,0
L52.3,123C49.5,120.2,49.5,115.8,52.3,113.1z"/>
<path fill="#1B1A1C" d="M57,75.5L57,75.5c3.9,0,7,3.1,7,7v36c0,3.9-3.1,7-7,7h0c-3.9,0-7-3.1-7-7v-36C50,78.6,53.1,75.5,57,75.5z"/>
<path fill="#1B1A1C" d="M86.9,52.3L86.9,52.3c2.7,2.7,2.7,7.2,0,9.9L61.5,87.6c-2.7,2.7-7.2,2.7-9.9,0l0,0c-2.7-2.7-2.7-7.2,0-9.9
L77,52.3C79.8,49.5,84.2,49.5,86.9,52.3z"/>
</g>
</svg>
/*
* Based on the animation
* by David Urbinati.
*
* Link to dribbble shot:
* http://drbl.in/mBsi
*/
/** 1 **/
@for $i from 1 through 8 {
.load1 path:nth-of-type(#{$i}) {
-webkit-animation:spin_half 2s .15s*$i cubic-bezier(0.19, 1, 0.22, 1) infinite;
animation:spin_half 2s .15s*$i cubic-bezier(0.19, 1, 0.22, 1) infinite;
}
}
/** 2 **/
// Array of segment pairs
$combinations: (
(1, 5), (2, 6), (3, 7), (4, 8)
);
// Loop through segment array
// Set respective paris of segments
// to animate together.
@each $pos in $combinations {
.load2 path:nth-of-type(#{nth($pos, 1)}),
.load2 path:nth-of-type(#{nth($pos, 2)}) {
-webkit-animation: spin_full 2s linear infinite;
animation: spin_full 2s linear infinite;
}
}
/** 3 **/
@for $j from 1 through 8 {
.load3 path:nth-of-type(#{$j}) {
-webkit-animation: spin_full 2s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
animation: spin_full 2s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
}
}
/** 4 **/
@for $i from 1 through 8 {
.load4 path:nth-of-type(#{$i}) {
-webkit-animation: spin_single_neg 1.8s .1s*$i cubic-bezier(0.19, 1, 0.22, 1) infinite;
animation: spin_single_neg 1.8s .1s*$i cubic-bezier(0.19, 1, 0.22, 1) infinite;
}
}
/** 5 **/
@for $i from 1 through 8 {
.load5 path:nth-of-type(#{$i}) {
-webkit-animation: spin_single 1.8s .1s*$i cubic-bezier(0.115, 0.97, 0.14, 1) infinite;
animation: spin_single 1.8s .1s*$i cubic-bezier(0.115, 0.97, 0.14, 1) infinite;
}
}
/** 6 **/
@for $i from 1 through 8 {
.load6 path:nth-of-type(#{$i}) {
-webkit-animation: spin_single 1s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
animation: spin_single 1s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
}
// Transform paths from origin
// in order to rotate from center.
.pre path {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
// Spin me 'round.
@-webkit-keyframes spin_half {
0% { -webkit-transform: rotate(0deg); }
50% { -webkit-transform: rotate(360deg); }
}
@keyframes spin_half {
0% { transform: rotate(0deg); }
50% { transform: rotate(360deg); }
}
@-webkit-keyframes spin_full {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin_full {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@-webkit-keyframes spin_single_neg {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(-180deg); }
}
@keyframes spin_single_neg {
0% { transform: rotate(0deg); }
100% { transform: rotate(-180deg); }
}
@-webkit-keyframes spin_single {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(180deg); }
}
@keyframes spin_single {
0% { transform: rotate(0deg); }
100% { transform: rotate(180deg); }
}
//----------------------------------
// Presentation Styles
body { text-align: center; }
svg {
display: inline-block;
margin-right: 2em;
&:last-child { margin-right: 0; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment