Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- from https://dribbble.com/shots/1136439-Little-Gears-Preloader-GIF -->

<div class="c-container">
  <div class="c-animation">
    <div class="c-gear">
      <svg xmlns="http://www.w3.org/2000/svg" width="26.531" height="27.063" viewBox="0 0 26.531 27.063" class="gear gear1" gear-status="start" gear-duration="start" id="gear1">
  <path id="gear_01" class="cls-1" d="M198.092,158.179q0.357-.641.661-1.3,0.222-.477.418-0.9,3.816-.013,3.96-0.919,0.169-.837-3.4-2.1a6.677,6.677,0,0,0-.167-2.153q3.546-1.968,3.258-2.791-0.314-.893-4.228-0.071a11.459,11.459,0,0,0-1.128-1.677l0.064-.137q2.158-3.42,1.488-4.018t-3.752,2.039l-0.185.15a9.378,9.378,0,0,0-.853-0.457l-0.646-.3c0-.079,0-0.159,0-0.238q0.248-4.134-.62-4.312t-2.354,3.733l-0.086.186a7.084,7.084,0,0,0-1.987.166l-0.076-.085q-1.82-3.552-2.659-3.314-0.816.309-.245,4.253a0.663,0.663,0,0,0,.027.19,12.412,12.412,0,0,0-1.83,1.271l-0.04-.018q-3.377-2.143-3.978-1.45-0.588.641,1.936,3.774a0.409,0.409,0,0,1,.119.114,10.411,10.411,0,0,0-.488.924q-0.217.468-.389,0.959a0.394,0.394,0,0,1-.165-0.017q-4.016-.032-4.16.875t3.578,2.188l0.181,0.084a5.929,5.929,0,0,0,.152,1.734q-3.553,1.963-3.288,2.835,0.312,0.893,4.224.079a12.645,12.645,0,0,0,1.062,1.695q-2.049,3.3-1.416,3.885t3.64-1.924q0.577,0.328,1.176.607l0.552,0.257q-0.185,3.877.694,4.051,0.82,0.156,2.243-3.371a8.914,8.914,0,0,0,2.283-.205q1.744,3.34,2.56,3.032,0.793-.26.206-4.045a10.456,10.456,0,0,0,1.674-1.06q3.159,1.994,3.785,1.371Q200.433,161.108,198.092,158.179Zm-5.784.984a6.375,6.375,0,0,1-5.14-.152,6.265,6.265,0,0,1-3.423-3.838,6.608,6.608,0,0,1,.271-5.156,6.684,6.684,0,0,1,3.8-3.58,6.264,6.264,0,0,1,5.14.152,6.37,6.37,0,0,1,3.423,3.837,6.676,6.676,0,0,1-.3,5.212A6.6,6.6,0,0,1,192.308,159.163Z" transform="translate(-176.594 -139)"/>
</svg>

      <svg xmlns="http://www.w3.org/2000/svg" width="20.781" height="20.719" viewBox="0 0 20.781 20.719" class="gear gear2" id="gear2">
  <path id="gear_02" class="cls-1" d="M219.36,157.318q2.136-2.3,1.607-3.025t-3.368.619c-0.158.074-.313,0.145-0.466,0.215a7.273,7.273,0,0,0-2.026-1.166c-0.015-.194-0.024-0.374-0.027-0.541q-0.105-3.184-.979-3.284-0.906-.139-1.968,2.793c-0.072.179-.15,0.381-0.233,0.6a7.335,7.335,0,0,0-2.076.538,4.6,4.6,0,0,1-.5-0.437q-2.31-2.13-3.031-1.6t0.619,3.368q0.135,0.271.3,0.583a5.671,5.671,0,0,0-1.174,1.842q-0.357.018-.646,0.04-3.187.117-3.327,1.022-0.1.874,2.9,1.942a2.709,2.709,0,0,0,.507.188,6.56,6.56,0,0,0,.489,2.355,1.787,1.787,0,0,0-.327.3q-2.134,2.3-1.606,3.024t3.368-.619a1.41,1.41,0,0,0,.312-0.165,7.416,7.416,0,0,0,2.136,1.4c0.009,0.071.021,0.144,0.033,0.219q0.117,3.188,1.017,3.32,0.864,0.169,1.937-2.834a0.666,0.666,0,0,0,.057-0.168,6.868,6.868,0,0,0,2.656-.583,0.2,0.2,0,0,1,.126.087q2.309,2.142,3.03,1.614t-0.617-3.381a0.513,0.513,0,0,1-.082-0.183,7.414,7.414,0,0,0,1.388-2.315,0.285,0.285,0,0,1,.184-0.008q3.12-.122,3.286-0.992,0.144-.9-2.866-1.966a0.77,0.77,0,0,0-.232-0.073,7.445,7.445,0,0,0-.663-2.418C219.183,157.532,219.271,157.426,219.36,157.318Zm-2.053,4.1a4.914,4.914,0,0,1-.538,1.63,5.154,5.154,0,0,1-1.377,1.494,4.931,4.931,0,0,1-1.732.835l-0.025-.034a4.727,4.727,0,0,1-1.75.047,4.493,4.493,0,0,1-3.135-1.844,4.7,4.7,0,0,1-.867-3.62,4.452,4.452,0,0,1,1.867-3.088,4.628,4.628,0,0,1,3.555-.883,4.79,4.79,0,0,1,3.149,1.949A4.573,4.573,0,0,1,217.307,161.419Z" transform="translate(-202.063 -150.125)"/>
</svg>

      <svg xmlns="http://www.w3.org/2000/svg" width="16.688" height="17.688" viewBox="0 0 16.688 17.688" class="gear gear3" id="gear3">
    <path id="gear_03" class="cls-1" d="M210.045,131.931a5.318,5.318,0,0,0-1.057.161,9.331,9.331,0,0,0-1-.909q-0.417-.325-0.812-0.576a8.012,8.012,0,0,0-.124-0.947q-0.3-2.691-1.2-2.8-0.956-.145-1.9,2.429a7.584,7.584,0,0,0-.273.773,5.746,5.746,0,0,0-2.131.852q-0.56-.3-1.035-0.536-2.48-1.074-3.024-.376-0.576.739,1.1,2.841a10.53,10.53,0,0,0,.787.942,6.043,6.043,0,0,0-.182,2.112,7.21,7.21,0,0,0-.89.631q-2.235,1.5-1.863,2.388,0.328,0.844,2.973.529c0.388-.052.814-0.117,1.275-0.194a5.607,5.607,0,0,0,.589.527,6.2,6.2,0,0,0,.97.621q0.056,0.7.131,1.36,0.33,2.636,1.209,2.789,0.939,0.077,1.89-2.422,0.255-.662.468-1.357a5.329,5.329,0,0,0,1.6-.609,10.027,10.027,0,0,0,.985.44q2.49,1.149,3.066.409,0.544-.7-1.142-2.874-0.309-.376-0.652-0.78a4.564,4.564,0,0,0,.255-1.783,7.919,7.919,0,0,0,1.1-.727q2.193-1.53,1.863-2.388T210.045,131.931Zm-2.1,3.118a3.2,3.2,0,0,1-.662,2.463,3.263,3.263,0,0,1-2.262,1.283,3.211,3.211,0,0,1-2.459-.662,3.389,3.389,0,0,1-.6-4.769,3.2,3.2,0,0,1,2.229-1.241,3.287,3.287,0,0,1,2.509.7A3.216,3.216,0,0,1,207.943,135.049Z" transform="translate(-196.375 -126.875)"/>
  </svg>
    </div>

  </div>

  <div class="c-controller-wrapper">
    <section class="c-controller">
      <h1>Settings</h1>
      <button class="u-btn" data-start="start" id="start">Stop</button>
    </section>
  </div>

</div>
<!-- logo grid for design credits -->
<a href="https://dribbble.com/shots/1136439-Little-Gears-Preloader-GIF" target="_blank" rel="noreferrer noopener">
  <div class="u-logo">
    Gear Design from
    <span class="u-logo__text">Dribbble</span>
    <svg xmlns="http://www.w3.org/2000/svg" width="132" class="u-logo__svg" height="32" viewBox="0 0 132 32" fill="none">
<rect width="131.556" height="32" fill="white" fill-opacity="0"></rect>
<path fill-rule="evenodd" clip-rule="evenodd" d="M131.352 25.2639C125.854 34.5449 117.148 31.8518 114.533 29.7433C113.42 30.4952 111.469 32.1431 108.867 31.953C103.325 31.5478 101.341 23.6623 101.341 23.6623C101.381 23.6939 99.6903 24.2432 98.7766 24.2335C98.7648 26.5459 96.7573 32.0699 91.3398 31.9993C85.2603 31.9204 84.0244 22.9014 84.0244 22.9014C84.0244 22.9014 83.4194 23.7379 81.1191 24.5711C81.2348 22.7945 81.1501 31.7289 73.8638 31.8602C68.1035 31.9641 66.5484 22.7623 66.5484 22.7623C66.5484 22.7623 65.549 23.796 63.6124 24.1545C63.7355 22.349 63.5355 31.8905 56.2481 31.8602C51.3235 31.8397 49.6406 26.1918 49.7715 25.408C49.9385 24.4088 48.1071 32.0007 43.3235 31.8824C41.3495 31.8246 39.8777 30.4015 38.9543 28.5039C37.7181 29.9126 35.9231 31.8824 33.9096 31.8824C30.2954 31.8824 28.7019 28.8722 28.9718 20.2744C28.9948 19.2548 28.9209 18.8536 27.903 18.7011C27.2919 18.5996 26.6661 18.4075 26.0041 18.306C25.7919 19.0112 23.9919 31.6529 17.8027 31.8928C15.7264 31.9735 14.5911 30.1824 13.6587 28.853C12.2294 30.7358 10.3427 31.953 7.65493 31.953C3.10203 31.953 0 28.2879 0 23.7668C0 19.2457 3.10203 15.581 7.65493 15.581C8.45992 15.581 8.6859 15.6959 9.42132 15.9096C7.90892 2.19775 11.4806 0.0547897 14.6051 0.0547897C17.6047 0.0547897 22.7294 6.98749 15.5186 24.5725C17.1195 29.8176 20.5707 29.5209 22.2293 18.7236C22.5667 16.5287 21.6642 13.567 23.0681 13.1536C25.6343 12.3982 25.9066 14.6648 27.1097 15.0424C28.3821 15.4416 29.1247 15.4026 30.346 15.6566C32.4331 16.0624 33.2476 17.1788 32.9932 19.6653C32.6879 22.8117 32.1538 27.3909 33.7824 27.9489C34.9569 28.3544 37.1013 25.9291 37.4775 24.602C37.8537 23.275 37.9323 22.8207 37.9657 21.8474C38.0167 19.7671 38.0804 18.2422 38.4367 16.6688C38.5892 16.0601 38.763 15.6569 39.4547 15.6294C40.0238 15.6149 41.0647 15.4442 41.5229 15.7994C42.1336 16.2563 42.0573 16.7199 41.9871 17.9401C41.2769 35.3378 46.7434 26.6528 48.3733 19.6986C47.793 11.8351 48.1915 0.198785 53.14 0.00362164C55.7137 -0.0978739 56.8514 1.95518 56.9765 3.4876C57.3305 7.81568 55.3476 14.9851 52.7399 19.8065C51.2496 29.6443 59.2563 31.5896 60.5367 23.737C58.4418 22.7452 56.1779 18.7308 58.0201 16.7744C59.0539 15.6765 63.357 17.2539 63.4275 20.6938C65.5382 20.1317 65.82 18.9451 65.8493 19.1417C65.269 11.2782 65.8071 0.198885 70.756 0.00372212C73.3293 -0.0977734 74.467 1.95528 74.5922 3.4877C74.9461 7.81578 72.9633 14.9852 70.3559 19.8066C68.8653 29.6444 76.8723 31.5896 78.1524 23.7371C76.6014 23.4391 73.3273 19.1693 75.2164 16.7745C76.2259 15.4948 80.5131 18.156 80.9932 20.8078C83.021 20.2363 83.2963 19.0873 83.3253 19.2808C82.745 11.4175 83.2831 0.338244 88.232 0.143081C90.8053 0.0415859 91.943 2.09464 92.0682 3.62705C92.4221 7.95514 90.4393 15.1247 87.8316 19.9462C86.3413 29.7839 94.348 31.7288 95.6284 23.8763C93.4971 23.5229 90.4679 19.0145 92.906 16.7081C93.88 15.7866 97.6018 18.1786 98.473 20.9077C99.6835 20.8613 100.437 20.4457 100.599 20.4037C98.6659 11.1725 100.105 0.0963155 105.428 0.00385746C108.306 -0.0460672 111.119 1.55286 109.884 10.3352C108.705 18.7145 104.469 22.2311 104.479 22.2849C104.725 23.2887 106.899 31.6899 112.374 27.2572C112.09 26.6182 111.806 25.9654 111.648 25.1745C110.741 20.5681 112.523 15.365 117.367 14.524C120.142 14.0423 122.757 15.3878 123.17 18.4212C123.85 23.3848 119.349 26.9797 117.638 27.7594C116.871 27.3257 124.587 32.2533 129.166 22.3783C129.432 21.8145 129.752 21.8622 130.166 22.1528C130.459 22.3581 132.128 23.9318 131.352 25.2639ZM10.9668 22.5472C10.7338 21.8535 10.2556 20.3252 10.0865 19.663C9.15532 18.8567 8.49065 18.7256 7.29537 18.7256C4.63907 18.7256 3.07561 21.1711 3.07561 23.8081C3.07561 26.4451 4.77888 28.891 7.43518 28.891C9.73719 28.891 11.4892 27.3324 12.0237 25.1261C11.6496 24.266 11.2785 23.4755 10.9668 22.5472ZM14.54 3.6844C12.6735 3.6844 12.0404 8.11802 12.1633 11.9003C12.2719 15.2443 13.2103 18.1884 13.6971 19.5074C13.8207 19.6727 13.7978 19.5652 13.9081 19.7406C17.1489 12.6699 15.8047 3.6844 14.54 3.6844ZM53.4066 3.82366C50.9942 3.54817 51.0097 13.5548 51.3093 15.7994C52.5621 13.8035 54.7386 4.36104 53.4066 3.82366ZM71.0222 3.82366C68.6099 3.54817 68.6254 13.5548 68.925 15.7994C70.1777 13.8035 72.3543 4.36104 71.0222 3.82366ZM88.4982 3.96289C86.0859 3.68739 86.1014 13.694 86.401 15.9388C87.6537 13.9428 89.8303 4.50023 88.4982 3.96289ZM105.695 3.2379C101.936 3.98946 102.811 16.4679 103.382 18.6564C107.809 12.6015 107.9 3.01046 105.695 3.2379ZM119.78 18.8318C119.589 18.0362 118.634 17.6109 117.974 17.7157C116.087 17.9724 114.257 20.3127 114.965 23.876C115.123 24.6695 115.518 25.3999 115.511 25.3757C119.735 22.5543 120.094 20.3309 119.78 18.8318ZM40.1946 12.8751C39.6552 12.8752 39.1279 12.716 38.6794 12.4177C38.2308 12.1194 37.8812 11.6953 37.6748 11.1991C37.4683 10.7029 37.4142 10.1569 37.5194 9.63014C37.6246 9.10336 37.8843 8.61947 38.2657 8.23966C38.647 7.85986 39.1329 7.6012 39.662 7.4964C40.191 7.3916 40.7393 7.44537 41.2376 7.65091C41.7359 7.85644 42.1619 8.20452 42.4615 8.6511C42.7612 9.09769 42.9211 9.62273 42.921 10.1598C42.9211 10.5164 42.8506 10.8694 42.7135 11.1989C42.5765 11.5283 42.3757 11.8276 42.1225 12.0797C41.8694 12.3319 41.5688 12.5319 41.238 12.6684C40.9072 12.8048 40.5526 12.8751 40.1946 12.8751Z" fill="white"></path>
</svg>
  </div>
</a>
              
            
!

CSS

              
                //text color
$bg: linear-gradient(180deg,#8AC7D0, #67B6C2)
$text: rgb(66, 66, 66)
$btn: rgb(0, 87, 183)

//mobile query based on bootstrap
$phone: "only screen and (min-width : 576px)"
$tablet: "only screen and (min-width : 768px)"
$laptop: "only screen and (min-width : 992px)"
$desktop: "only screen and (min-width : 1200px)"
  
@mixin flex-center
  display: flex
  justify-content: center
  align-items: center
  flex-direction: row

body
  font-family: 'Lato', sans-serif
  width: 100%
  height: 100vh
  min-height: 100%
  background: rgb(25,25,25)
  @include flex-center
    
a
  color: white
  
*
  box-sizing: border-box
  
.c-container
  // background: white
  width: 100%
  max-width: 90vw
  min-height: 200px
  border-radius: 2em
  @include flex-center
  flex-direction: column
  align-items: stretch
  @media #{$tablet}
    flex-direction: row
    max-width: 50vw
    width: 100%
  
.c-controller-wrapper
  margin: auto
  background-color: white
  width: 100%
  @media #{$tablet}
    width: 50%
  
.c-controller
  width: 100%
  min-height: 200px
  padding: 1em
  margin: auto
  h1
    font-size: 1.5em
    margin: 0 0 0.8em 0
    
.c-speed-text
  font-size: 0.8em
  text-align: right
    
.c-controller-group
  padding: 1em 0
  label
    margin-right: 0.5em
    font-weight: bold
    display: block
  
.c-animation
  @include flex-center
  background: $bg
  width: 100%
  min-height: 200px
  @media #{$tablet}
    width: 50%
    height: auto
    min-height: initial
  
.c-gear
  position: relative
  width: 50px
  height: 50px
  margin: auto
  
.gear
  fill: white
  
.gear1
  position: absolute
  left: 10%
  top: 37%
  
  
.gear2
  position: absolute
  top: 50%
  left: 65%
  
.gear3
  position: absolute
  top: 8%
  left: 45%
    

//loading and tick svg settings
.u-hide
  display: none

.u-logo
  position: absolute
  right: 1em
  bottom: 1em
  color: white
  &__svg
    margin-left: 0.5em
    display: none
    @media #{$tablet}
      display: inline-block
  &__text
    display: inline-block
    @media #{$tablet}
      display: none
      
  &:hover
    opacity: 0.9
    cursor: pointer
.u-btn
  padding: 0.5em 1em
  background: #67B6C2
  color: white
  border: 0
  transition: ease 400ms
  will-change: transform
  cursor: pointer
  &:hover
    opacity: 0.9
  
  
  //range
input[type="range"] 
    -webkit-appearance: none
    width: 100%
    height: 15px
    border-radius: 5px   
    background: #d3d3d3
    outline: none
    opacity: 0.7
    transition: opacity .2s
    margin-top: 0.5em
  
  
input[type="range"]::-webkit-slider-thumb 
    -webkit-appearance: none
    appearance: none
    width: 25px
    height: 25px
    border-radius: 50% 
    background: #67B6C2
    cursor: pointer
  
input[type="range"]::-moz-range-thumb 
    width: 25px
    height: 25px
    border-radius: 50%
    background: #67B6C2
    cursor: pointer
  
              
            
!

JS

              
                (() => {
  const rotate = [
    { transform: "rotate(0deg)" },
    { transform: "rotate(360deg)" }
  ];

  const blink = [
    { transform: "rotate(0deg)", opacity: 1, offset: 0 },
    { opacity: 0, offset: 0.3 },
    { opacity: 1, offset: 0.5 },
    { opacity: 0, offset: 0.7 },
    { opacity: 1, offset: 0.9 },
    { transform: "rotate(360deg)", opacity: 1, offset: 1 }
  ];

  let gear1 = {
    duration: 1500,
    iterations: Infinity
  };

  
  function setStart() {
    const btn = document.getElementById("start");
    const status = document.getElementById("start").getAttribute("data-start");
    if (status === "stop") {
      //start all animations
      list.forEach(item => item.play());
      btn.setAttribute("data-start", "start");
      btn.innerText = "Stop";
    } else {
      //stop all animations
      list.forEach(item => item.pause());
      btn.setAttribute("data-start", "stop");
      btn.innerText = "Start";
    }
  }

  let firstGear = document.getElementById("gear1").animate(blink, gear1);
  const list = [firstGear];

  document.getElementById("start").addEventListener("click", setStart);

})();

              
            
!
999px

Console