cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <div class="dancer">
  <div></div>
  <div>
    <div>
      <div>
        <div>
          <div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div>
    <div>
      <div>
        <div>
          <div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div>
    <div>
      <div>
        <div>
          <div>
            <div>
              <div>
              </div>
            </div>
          </div>
          <div>
            <div>
              <div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
            
          
!
            
              :root {
  --dim: 40vmin;
  --borderWidth: 0px; //change to show div borders
}
body {
  background: #16161c;
  overflow: hidden;
  height: 100vh;
  perspective: 2000px;
}
div {
  --rx: 0deg;
  --ry: 0deg;
  --rz: 0deg;
  --delay: 0ms;
  --color: black;
  --timing: 1000ms;
  color: var(--color);
  
  will-change: transform;
  transition: transform var(--timing) ease-in-out;
  transition-timing-function: cubic-bezier(.5,0,.25,1);
  transition-delay: var(--delay);
  transform-origin: center center;
  transform-style: preserve-3d;
  perspective: 3000px;
}
.dancer {
  transform-style: preserve-3d;
  position: absolute;
  top: 25vh;
  bottom: 25vh;
  left: 25vw;
  right: 25vw;
  perspective: 1000px;
  animation: danceItOnUp 23000ms infinite alternate ease-in-out;//cubic-bezier(.36,.53,.62,.47);
}
.dancer > div {
  position: absolute;
  top: 10vh; right: 20vw; bottom: 30vh; left: 20vw;
  
  &:nth-of-type(2) {
    bottom: 10vh;
    right: 30vw;
    left: 20vw;
    top: 10vh;
  }
  &:nth-of-type(3) {
    bottom: 40vh;
    right: 20vw;
    left: 30vw;
    top: 20vh;
  }
  &:nth-of-type(4) {
    bottom: 10vh;
    right: 10vw;
    left: -10vw;
    top: 0vh;
  }
}


.dancer div {
  --color: hsl(320, 90%, 30%);
  --rad: 1.5rem;
  border: var(--borderWidth) solid hsla(0,0,100%,.5);
  
  height: var(--dim);
  width: var(--dim);
  
  //make the circle
  background-image: radial-gradient(circle at var(--rad) var(--rad), currentColor var(--rad), transparent var(--rad)); 
  background-position: left center;
  background-repeat: no-repeat;
  
  //rotations on rotations on rotations
  transform: translate3d(0,0,0) rotateX(var(--rx)) rotateY(var(--ry)) rotateZ(var(--rz));
}

@keyframes danceItOnUp {
  100% {
    transform: rotateX(360deg) rotateY(-720deg);
  }
}
            
          
!
            
              //Works on Latest Firefox/Chrome/Safari

var parts = Array.from(document.querySelectorAll('div'));

parts.forEach((part, i) => {
  //give each circle all a different color
  part.style.setProperty('--color', 'hsl('+(i * 12 + 205)+', 90%, 34%)');
  
  //Vary the delay a bit
  //part.style.setProperty('--delay', (Math.random() * 500 - 300) + 'ms');
  
  //give each circle a slightly different transition duration
  part.style.setProperty('--timing', (Math.random() * 400 + 800)+'ms');
  
  
  part.style.setProperty('--rad', (Math.random() * .75 + .75)+'rem');
});


animate();
setInterval(animate, 800);


function animate() {
  requestAnimationFrame(function() {
    parts.forEach((part) => {
      part.style.setProperty('--rx', (Math.random() * 280 - 140) + 'deg');
      part.style.setProperty('--ry', (Math.random() * 280 - 140) + 'deg');
      part.style.setProperty('--rz', (Math.random() * 280 - 140) + 'deg');
    });
  });
}
            
          
!
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