css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <ul class="loading__wrapper">
  <li>
    <svg class="loader1" fill="#FFF" height="80" viewBox="0 0 55 80" width="55" xmlns="http://www.w3.org/2000/svg">
      <g transform="matrix(1 0 0 -1 0 80)">
        <rect height="20" rx="3" width="10"></rect>
        <rect height="80" rx="3" width="10" x="15"></rect>
        <rect height="50" rx="3" width="10" x="30"></rect>
        <rect height="30" rx="3" width="10" x="45"></rect>
      </g>
    </svg>
  </li>
  <li>
    <svg class="loader2" height="45" stroke="#fff" viewBox="0 0 45 45" width="45" xmlns="http://www.w3.org/2000/svg">
      <g fill-rule="evenodd" fill="none" stroke-width="2" transform="translate(1 1)">
        <circle cx="22" cy="22" r="6" stroke-opacity="0"></circle>
        <circle cx="22" cy="22" r="6" stroke-opacity="0"></circle>
        <circle cx="22" cy="22" r="8"></circle>
      </g>
    </svg>
  </li>
  <li>
    <svg class="loader3" fill="#fff" height="105" viewBox="0 0 105 105" width="105" xmlns="http://www.w3.org/2000/svg">
      <circle cx="12.5" cy="12.5" r="12.5" fill-opacity="1"></circle>
      <circle cx="12.5" cy="52.5" r="12.5" fill-opacity="1"></circle>
      <circle cx="52.5" cy="12.5" r="12.5" fill-opacity="1"></circle>
      <circle cx="52.5" cy="52.5" r="12.5" fill-opacity="1"></circle>
      <circle cx="92.5" cy="12.5" r="12.5" fill-opacity="1"></circle>
      <circle cx="92.5" cy="52.5" r="12.5" fill-opacity="1"></circle>
      <circle cx="12.5" cy="92.5" r="12.5" fill-opacity="1"></circle>
      <circle cx="52.5" cy="92.5" r="12.5" fill-opacity="1"></circle>
      <circle cx="92.5" cy="92.5" r="12.5" fill-opacity="1"></circle>
    </svg>
  </li>
  <li>
    <svg class="loader4" fill="#fff" height="64" viewBox="0 0 140 64" width="140" xmlns="http://www.w3.org/2000/svg">
      <path class="loader4__heart" d="M30.262 57.02L7.195 40.723c-5.84-3.976-7.56-12.06-3.842-18.063 3.715-6 11.467-7.65 17.306-3.68l4.52 3.76 2.6-5.274c3.717-6.002 11.47-7.65 17.305-3.68 5.84 3.97 7.56 12.054 3.842 18.062L34.49 56.118c-.897 1.512-2.793 1.915-4.228.9z">
      </path>
      <path class="loader4__heart" d="M105.512 56.12l-14.44-24.272c-3.716-6.008-1.996-14.093 3.843-18.062 5.835-3.97 13.588-2.322 17.306 3.68l2.6 5.274 4.52-3.76c5.84-3.97 13.592-2.32 17.307 3.68 3.718 6.003 1.998 14.088-3.842 18.064L109.74 57.02c-1.434 1.014-3.33.61-4.228-.9z">
      </path>
      <path d="M67.408 57.834l-23.01-24.98c-5.864-6.15-5.864-16.108 0-22.248 5.86-6.14 15.37-6.14 21.234 0L70 16.168l4.368-5.562c5.863-6.14 15.375-6.14 21.235 0 5.863 6.14 5.863 16.098 0 22.247l-23.007 24.98c-1.43 1.556-3.757 1.556-5.188 0z"/>
    </svg>
  </li>
  <li>
    <svg version="1.1" class="loader5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
       viewBox="0 0 52 52" style="enable-background:new 0 0 52 52;" xml:space="preserve">
      <style type="text/css">
        .loader5__front{fill:none;stroke:#fff;stroke-width:2;stroke-miterlimit:10;}
        .loader5__back{fill:none;stroke:#fff;stroke-width:2;stroke-miterlimit:10;stroke-opacity:0.5;}
      </style>
      <path class="loader5__front" d="M51,26c0,13.8-11.2,25-25,25S1,39.8,1,26S12.2,1,26,1S51,12.2,51,26z"/>
      <path class="loader5__back" d="M51,26c0,13.8-11.2,25-25,25S1,39.8,1,26S12.2,1,26,1S51,12.2,51,26z"/>
    </svg>
  </li>
  <li>
    <svg class="loader6" fill="#fff" height="30" viewBox="0 0 120 30" width="120" xmlns="http://www.w3.org/2000/svg">
      <circle class="loader6__left" cx="15" cy="15" r="15"></circle>
      <circle class="loader6__center" cx="60" cy="15" r="15"></circle>
      <circle class="loader6__right" cx="105" cy="15" r="15"></circle>
    </svg>
  </li>
  <li>
    <svg class="loader7" height="58" viewBox="0 0 58 58" width="58" xmlns="http://www.w3.org/2000/svg">
      <g fill-rule="evenodd" fill="none">
        <g stroke-width="1.5" stroke="#FFF" transform="translate(2 1)">
          <circle cx="42.601" cy="11.462" fill-opacity="0" fill="#fff" r="5"></circle>
          <circle cx="49.063" cy="27.063" fill-opacity="0" fill="#fff" r="5"></circle>
          <circle cx="42.601" cy="42.663" fill-opacity="0" fill="#fff" r="5"></circle>
          <circle cx="27" cy="49.125" fill-opacity="0" fill="#fff" r="5"></circle>
          <circle cx="11.399" cy="42.663" fill-opacity="0" fill="#fff" r="5"></circle>
          <circle cx="4.938" cy="27.063" fill-opacity="0" fill="#fff" r="5"></circle>
          <circle cx="11.399" cy="11.462" fill-opacity="0" fill="#fff" r="5"></circle>
          <circle cx="27" cy="5" fill-opacity="0" fill="#fff" r="5"></circle>
        </g>
      </g>
    </svg>
  </li>
  <li>
    <svg class="loader8" height="44" stroke="#fff" viewBox="0 0 44 44" width="44" xmlns="http://www.w3.org/2000/svg">
      <g fill-rule="evenodd" fill="none" stroke-width="2">
        <circle cx="22" cy="22" r="0"></circle>
        <circle cx="22" cy="22" r="0"></circle>
      </g>
    </svg>
  </li>
  <li>
    <svg class="loader9" width="135" height="135" viewBox="0 0 135 135" xmlns="http://www.w3.org/2000/svg" fill="#fff">
      <path class="loader9__inner" d="M67.447 58c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10zm9.448 9.447c0 5.523 4.477 10 10 10 5.522 0 10-4.477 10-10s-4.478-10-10-10c-5.523 0-10 4.477-10 10zm-9.448 9.448c-5.523 0-10 4.477-10 10 0 5.522 4.477 10 10 10s10-4.478 10-10c0-5.523-4.477-10-10-10zM58 67.447c0-5.523-4.477-10-10-10s-10 4.477-10 10 4.477 10 10 10 10-4.477 10-10z">
      </path>
      <path class="loader9__outer" d="M28.19 40.31c6.627 0 12-5.374 12-12 0-6.628-5.373-12-12-12-6.628 0-12 5.372-12 12 0 6.626 5.372 12 12 12zm30.72-19.825c4.686 4.687 12.284 4.687 16.97 0 4.686-4.686 4.686-12.284 0-16.97-4.686-4.687-12.284-4.687-16.97 0-4.687 4.686-4.687 12.284 0 16.97zm35.74 7.705c0 6.627 5.37 12 12 12 6.626 0 12-5.373 12-12 0-6.628-5.374-12-12-12-6.63 0-12 5.372-12 12zm19.822 30.72c-4.686 4.686-4.686 12.284 0 16.97 4.687 4.686 12.285 4.686 16.97 0 4.687-4.686 4.687-12.284 0-16.97-4.685-4.687-12.283-4.687-16.97 0zm-7.704 35.74c-6.627 0-12 5.37-12 12 0 6.626 5.373 12 12 12s12-5.374 12-12c0-6.63-5.373-12-12-12zm-30.72 19.822c-4.686-4.686-12.284-4.686-16.97 0-4.686 4.687-4.686 12.285 0 16.97 4.686 4.687 12.284 4.687 16.97 0 4.687-4.685 4.687-12.283 0-16.97zm-35.74-7.704c0-6.627-5.372-12-12-12-6.626 0-12 5.373-12 12s5.374 12 12 12c6.628 0 12-5.373 12-12zm-19.823-30.72c4.687-4.686 4.687-12.284 0-16.97-4.686-4.686-12.284-4.686-16.97 0-4.687 4.686-4.687 12.284 0 16.97 4.686 4.687 12.284 4.687 16.97 0z">
      </path>
    </svg>
  </li>
  <li>
    <svg class="loader10" height="38" viewBox="0 0 38 38" width="38" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <linearGradient id="a" x1="8.042%" x2="65.682%" y1="0%" y2="23.865%">
          <stop offset="0%" stop-color="#fff" stop-opacity="0"/>
          <stop offset="63.146%" stop-color="#fff" stop-opacity=".631"/>
          <stop offset="100%" stop-color="#fff"/>
        </linearGradient>
      </defs>
      <g fill-rule="evenodd" fill="none">
        <g transform="translate(1 1)">
          <path d="M36 18c0-9.94-8.06-18-18-18" id="Oval-2" stroke-width="2" stroke="url(#a)"></path>
          <circle cx="36" cy="18" fill="#fff" r="1"></circle>
        </g>
      </g>
    </svg>
  </li>
  <li>
    <svg class="loader11" width="135" height="140" viewBox="0 0 135 140" xmlns="http://www.w3.org/2000/svg" fill="#fff">
      <rect class="loader11__inner3" y="10" width="15" height="120" rx="6"></rect>
      <rect class="loader11__inner2" x="30" y="10" width="15" height="120" rx="6"></rect>
      <rect class="loader11__center" x="60" width="15" height="140" rx="6"></rect>
      <rect class="loader11__inner2" x="90" y="10" width="15" height="120" rx="6"></rect>
      <rect class="loader11__inner3" x="120" y="10" width="15" height="120" rx="6"></rect>
    </svg>
  </li>
  <li>
    <svg class="loader12" height="57" stroke="#fff" viewBox="0 0 57 57" width="57" xmlns="http://www.w3.org/2000/svg">
      <g fill-rule="evenodd" fill="none">
        <g stroke-width="2" transform="translate(1 1)">
          <circle class="loader12__path-left" cx="5" cy="50" r="5"></circle>
          <circle class="loader12__path-top" cx="27" cy="5" r="5"></circle>
          <circle class="loader12__path-right" cx="50" cy="50" r="5"></circle>
        </g>
      </g>
    </svg>
  </li>
</ul>
<p class="desc">GSAP Version of <a href="http://samherbert.net/svg-loaders/" target="_blank">samherbert.net/svg-loaders</a></p>
            
          
!
            
              html, body {
  height: 100%;
}
html {
  background: linear-gradient(135deg, #3023ae 0%,#c86dd7 100%);
  background-position: fixed;
}
body {
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Open Sans","Helvetica Neue",sans-serif;
  letter-spacing: 0;
  font-weight: 400;
  font-style: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -moz-font-feature-settings: "liga" on;
  color: fade(#fff, 80);
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  
  *, *:before, *:after {
    box-sizing: inherit;
  }
}
a {
  color: #fff;
  text-decoration: none;
  position: relative;
  opacity: 0.8;
  transition: opacity 0.15s ease-in-out;
  
  &:after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: fade(#fff, 40);
    left: 50%;
    transform: translate(-50%, 300%) scale(0.95);
    pointer-events: none;
  }
  
  &:hover {
    opacity: 1;
    
    &:after {
      transform: translate(-50%, 150%) scale(1);
    }
  }
}

svg {
  visibility: hidden;
}

.loading__wrapper {
  width: 720px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  box-shadow: 0 0 4px 0 fade(#000, 40);
  
  > li {
    width: 180px;
    height: 180px;
    position: relative;
    transition: transform 0.15s ease-in-out;
    
    &:hover {
      transform: scale(1.15);
      z-index: 1;
      box-shadow: 0 0 4px 0 fade(#000, 40);
    }
    
    &:nth-child(1) {
      background: #1ABC9C;
    }
    &:nth-child(2) {
      background: #34495E;
    }
    &:nth-child(3) {
      background: #F39C12;
    }
    &:nth-child(4) {
      background: #9B59B6;
    }
    &:nth-child(5) {
      background: #3498DB;
    }
    &:nth-child(6) {
      background: #E74C3C;
    }
    &:nth-child(7) {
      background: #2ECC71;
    }
    &:nth-child(8) {
      background: #2C3E50;
    }
    &:nth-child(9) {
      background: #F1C40F;
    }
    &:nth-child(10) {
      background: #8E44AD;
    }
    &:nth-child(11) {
      background: #2980B9;
    }
    &:nth-child(12) {
      background: #E74C3C;
    }
    
    > svg {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 60px;
      height: 60px;
    }
  }
}

.desc {
  margin-top: 15px;
}
            
          
!
            
              function randomIntFromInterval(min,max) {
  return Math.floor(Math.random()*(max-min+1)+min);
}

TweenMax.set('svg', {
  visibility: 'visible'
});

// Loader 1
const loader1Bar1Heights = [20,45,57,80,64,32,66,45,64,23,66,13,64,56,34,34,2,23,76,79,20];
const loader1Bar1Timeline = new TimelineMax({repeat:-1});
const loader1Bar2Heights = [80,55,33,5,75,23,73,33,12,14,60,80];
const loader1Bar2Timeline = new TimelineMax({repeat:-1});
const loader1Bar3Heights = [50,34,78,23,56,23,34,76,80,54,21,50];
const loader1Bar3Timeline = new TimelineMax({repeat:-1});
const loader1Bar4Heights = [30,45,13,80,56,72,45,76,34,23,67,30];
const loader1Bar4Timeline = new TimelineMax({repeat:-1});

function tlArrayStep(element, timeline, duration, array) {  
  for (let i = 0, length = array.length; i < length; i++) {
    timeline.to(element, duration, {height: array[i]});
  }
}

tlArrayStep('.loader1 rect:nth-child(1)', loader1Bar1Timeline, (4.3 / loader1Bar1Heights.length), loader1Bar1Heights);
tlArrayStep('.loader1 rect:nth-child(2)', loader1Bar2Timeline, (2 / loader1Bar2Heights.length), loader1Bar2Heights);
tlArrayStep('.loader1 rect:nth-child(3)', loader1Bar3Timeline, (1.4 / loader1Bar3Heights.length), loader1Bar3Heights);
tlArrayStep('.loader1 rect:nth-child(4)', loader1Bar4Timeline, (2 / loader1Bar4Heights.length), loader1Bar4Heights);

// Loader 2
TweenMax.to('.loader2 circle:nth-child(1)', 2, {
  attr: {
    r: 22,
    "stroke-width": 1,
    "stroke-opacity": 1
  },
  opacity: 0,
  repeat: -1,
  delay: 1
});
TweenMax.to('.loader2 circle:nth-child(2)', 2, {
  attr: {
    r: 22,
    "stroke-width": 1,
    "stroke-opacity": 1
  },
  opacity: 0,
  repeat: -1
});
TweenMax.to('.loader2 circle:nth-child(3)', 1.5, {
  attr: {
    r: 1
  },
  repeat: -1,
  yoyo: true,
  ease: Power2.easeOut
});

// Loader 3
TweenMax.staggerTo('.loader3 circle', 0.5, {
  attr: {
    "fill-opacity": 0
  },
  repeat: -1,
  yoyo: true,
  ease: Power0.easeNone
}, 0.25);

// Loader 4
const loader4__hearts = document.querySelectorAll('.loader4__heart'); 
let loader4Count;

TweenMax.set('.loader4__heart:first-child', {
  opacity: 0.5
});
for (loader4Count = 0; loader4Count < loader4__hearts.length; ++loader4Count) {
  let opacityProp = 0.5;
  if (loader4Count === 0) {
    opacityProp = 1;
  }
  
  TweenMax.to(loader4__hearts[loader4Count], 0.75, {
    opacity: opacityProp,
    repeat: -1,
    yoyo: true,
    ease: Power0.easeNone
  });
  
}

// Loader 5
const loader5Front = document.querySelector('.loader5__front');

TweenMax.set(loader5Front, {
  drawSVG: '25% 45%'
});
TweenMax.to(loader5Front, 1, {
  rotation: 360,
  repeat: -1,
  transformOrigin: '50% 50%',
  ease: Power0.easeNone
});

// Loader 6
const loader6__circles = document.querySelectorAll('.loader6 circle');
let loader6Count;

TweenMax.set('.loader6__center', {
  opacity: 0.3,
  scale: 0.6,
  transformOrigin: '50% 50%'
});
for (loader6Count = 0; loader6Count < loader6__circles.length; ++loader6Count) {
  let scaleProp = 0.6;
  let opacityProp = 0.3;
  if (loader6Count === 1) {
    scaleProp = 1;
    opacityProp = 1;
  }
  
  TweenMax.to(loader6__circles[loader6Count], 0.5, {
    opacity: opacityProp,
    scale: scaleProp,
    repeat: -1,
    yoyo: true,
    transformOrigin: '50% 50%',
    ease: Power0.easeNone
  });
  
}

// Loader 7
const loader7Timeline = new TimelineMax({repeat: -1});

loader7Timeline.staggerTo('.loader7 circle', 0.4, {
  attr: {
    "fill-opacity": 1
  }
}, 0.2)
.staggerTo('.loader7 circle', 0.4, {
  attr: {
    "fill-opacity": 0
  }
}, 0.2, 0.4);

// Loader 8
TweenMax.staggerTo('.loader8 circle', 2, {
  attr: {
    r: 20
  },
  opacity: 0,
  repeat: -1
}, 1);

// Loader 9
TweenMax.to('.loader9__inner', 2, {
  rotation: -360,
  repeat: -1,
  transformOrigin: '50% 50%',
  ease: Power0.easeNone
});
TweenMax.to('.loader9__outer', 3, {
  rotation: 360,
  repeat: -1,
  transformOrigin: '50% 50%',
  ease: Power0.easeNone
});

// Loader 10
TweenMax.to('.loader10', 1, {
  rotation: 360,
  repeat: -1,
  ease: Power0.easeNone
})

// Loader 11
const loader11Timeline = new TimelineMax({repeat: -1});

TweenMax.to('.loader11__center', 0.5, {
  attr: {
    height: 10,
  },
  y: 60,
  repeat: -1,
  yoyo: true,
  stagger: 5
});
TweenMax.to('.loader11__inner2', 0.5, {
  attr: {
    height: 10
  },
  y: 50,
  repeat: -1,
  yoyo: true,
  delay: 0.25
});
TweenMax.to('.loader11__inner3', 0.5, {
  attr: {
    height: 10
  },
  y: 50,
  repeat: -1,
  yoyo: true,
  delay: 0.35
});

// Loader 12
const loader12Timeline = new TimelineMax({repeat:-1});

loader12Timeline.to('.loader12__path-top', 0.75, {
  attr: {
    cx: 50, 
    cy: 50
  }
}, "l12_1")
.to('.loader12__path-left', 0.75, {
  attr: {
    cx: 27, 
    cy: 5
  }
}, "l12_1")
.to('.loader12__path-right', 0.75, {
  attr: {
    cx: 5, 
    cy: 50
  }
}, "l12_1");
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console