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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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
Loading ..................

Console