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.

            
              <div class="wrapper">

  <div class="inner">
  
  <svg id="spin" width="520px" height="520px" viewBox="0 0 520 520" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
      <g id="Home" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
          <g id="Spinner">
              <rect id="force-size" fill-opacity="0" fill="#D8D8D8" x="0" y="0" width="520" height="520"></rect>
              <g id="pulse-inner" transform="translate(95.000000, 95.000000)" fill="#2C2C2C">
                  <path d="M165,330 C73.8730163,330 0,256.126984 0,165 C0,73.8730163 73.8730163,0 165,0 C256.126984,0 330,73.8730163 330,165 C330,256.126984 256.126984,330 165,330 Z M165,311.699463 C246.019876,311.699463 311.699463,246.019876 311.699463,165 C311.699463,83.9801236 246.019876,18.3005367 165,18.3005367 C83.9801236,18.3005367 18.3005367,83.9801236 18.3005367,165 C18.3005367,246.019876 83.9801236,311.699463 165,311.699463 Z" id="circle"></path>
              </g>
              <g id="pulse-outer" transform="translate(64.000000, 64.000000)" fill="#808080">
                  <path d="M196,0 C217.0896,0 238.0616,3.4097186 258.0732,10.0919832 L255.584,17.518899 C236.376,11.1109796 216.2468,7.83843356 196,7.83843356 L196,0 Z" id="Dash-0"></path>
                  <path d="M287.0812,22.4375161 C305.76,32.235558 322.7336,45.0122047 337.3552,60.2187658 L331.7104,65.6468811 C317.6768,51.0477986 301.3696,38.8002461 283.4356,29.3941259 L287.0812,22.4375161 Z" id="Dash-1"></path>
                  <path d="M357.308,84.6354864 C369.2836,101.997617 378.3976,121.182183 384.258,141.444534 L376.7316,143.619699 C371.1064,124.160788 362.3648,105.760065 350.8596,89.1033935 L357.308,84.6354864 Z" id="Dash-2"></path>
                  <path d="M390.5692,172.347558 C393.1172,193.295772 392.2548,214.479138 388.0408,235.153007 L380.3576,233.58532 C384.4148,213.754083 385.238,193.393752 382.788,173.28817 L390.5692,172.347558 Z" id="Dash-3"></path>
                  <path d="M379.26,265.448553 C371.7728,285.162213 361.1692,303.54334 347.8216,319.886474 L341.7456,314.928664 C354.564,299.251797 364.756,281.595726 371.9296,262.665909 L379.26,265.448553 Z" id="Dash-4"></path>
                  <path d="M325.9676,342.637527 C310.17,356.629131 292.236,367.975264 272.832,376.244811 L269.7548,369.033452 C288.3944,361.097038 305.6228,350.201615 320.7736,336.778298 L325.9676,342.637527 Z" id="Dash-5"></path>
                  <path d="M242.9028,386.219218 C222.4208,391.275007 201.2528,392.999463 180.222,391.294603 L180.8688,383.475766 C201.0568,385.102241 221.3624,383.45617 241.0212,378.615937 L242.9028,386.219218 Z" id="Dash-6"></path>
                  <path d="M149.0972,386.219218 C128.6152,381.163428 109.074,372.854688 91.238,361.58694 L95.4324,354.963464 C112.5432,365.780502 131.32,373.775704 150.9788,378.615937 L149.0972,386.219218 Z" id="Dash-7"></path>
                  <path d="M66.0324,342.637527 C50.2348,328.645923 36.8088,312.204809 26.264,293.941259 L33.0456,290.022042 C43.1788,307.560537 56.0756,323.35498 71.2264,336.778298 L66.0324,342.637527 Z" id="Dash-8"></path>
                  <path d="M12.74,265.448553 C5.2528,245.734892 0.9996,224.943447 0.1568,203.858061 L7.9968,203.544524 C8.82,223.767682 12.8968,243.736092 20.0704,262.665909 L12.74,265.448553 Z" id="Dash-9"></path>
                  <path d="M1.4308,172.347558 C3.9788,151.399344 9.8784,130.999821 18.914,111.952427 L26.0092,115.322954 C17.3264,133.625696 11.662,153.182588 9.212,173.28817 L1.4308,172.347558 Z" id="Dash-10"></path>
                  <path d="M34.692,84.6354864 C46.6676,67.273356 61.3872,51.9884106 78.2628,39.3097443 L82.9668,45.5608951 C66.7772,57.7300632 52.6456,72.4467222 41.1404,89.1033935 L34.692,84.6354864 Z" id="Dash-11"></path>
                  <path d="M104.9188,22.4375161 C123.5976,12.6394741 143.7464,5.91801734 164.5616,2.52789482 L165.816,10.268348 C145.824,13.5212979 126.4984,19.9880056 108.5644,29.3941259 L104.9188,22.4375161 Z" id="Dash-12"></path>
              </g>
          </g>
      </g>
  </svg>
  </div>
    
</div>

            
          
!
            
              $color-bg-dark: #3e3e3e;

html, body {
  height: 100%;
  width: 100%;
  background-image: linear-gradient(340deg, $color-bg-dark 0%, lighten($color-bg-dark,50%) 100%);
  background-attachment: fixed;
}

.wrapper {
  postion: relative;
  height: 100%;
}

.inner {
  position: relative;
  top: 50%;
  margin: 0 auto;
  transform: translateY(-50%);
  text-align: center;
  
  svg {
    position: relative;
    width: 400px;
  }
}
            
          
!
            
              $(function() {

  var $spinner = $('#spin');
  var $spinnerOuter = $("#pulse-outer");

  // Creates a clone of svg element [id] as [newID]
  function cloneSVG(id, newID, x, y, parentID) {
    var node = document.getElementById(id);
    var newNode = node.cloneNode("true");
    newNode.id = newID;
    newNode.setAttributeNS(null, "cx", x);
    newNode.setAttributeNS(null, "cy", y);
    document.getElementById(parentID).appendChild(newNode);
  }

  // Creates a new svg element [id] attached to [parentID]
  function createSVGElement(id, cssClass, x, y, parentID) {
    var svg = document.createElementNS("http://www.w3.org/2000/svg","circle");
    svg.setAttributeNS(null, "id", id);
    svg.setAttributeNS(null, "cx", x);
    svg.setAttributeNS(null, "cy", y);
    svg.setAttributeNS(null, "r", 20);
    svg.setAttributeNS(null, "fill","black");
    svg.setAttributeNS(null, "stroke","none");
    svg.setAttributeNS(null, "class", cssClass);
    document.getElementById(parentID).appendChild(svg);
  }

  // Creates a new project
  function createProject(id, x, y) {
    createSVGElement(id, "spinner__project", x, y, "Spinner")
  }

  function initSpinner() {

    var outerRing = new TweenMax.to(
      $spinnerOuter, 30, {
        rotation: 360, transformOrigin:"center center", ease: Linear.easeNone, repeat:-1
      },{
        timeScale: 1
      }
    );

    $spinner.on("mouseover", function() {
        TweenLite.to(
          outerRing, 1, {timeScale: 20}
        );
    });

    $spinner.on("mouseout", function() {
        TweenLite.to(
          outerRing, 1, {timeScale: 1}
        );
    });

    createProject("test1", 200, 200);

    cloneSVG("test1", "test2", 300, 300, "Spinner");
    cloneSVG("test1", "test3", 300, 340, "Spinner");
    cloneSVG("test1", "test4", 300, 380, "Spinner");
  }

  initSpinner();

})


            
          
!
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