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="world">
  <div class="bottomline">[rainbow infinity] by <a href="https://rjmr.uk" target="_blank">just rachel</a></div>
  <div class="controls">
    <div class="speed">S P E E D</div>
    <input id="speed" step="0.01" type="range" name="speed" min="1" max="8" value="4.5" data-sizing="s">
  </div>
  <div class="loopcircleblock2">
    <div class="loopcircle">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  <div class="loopcircle3">
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </div>
  <div class="loopcircle">
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </div>
  <div class="loopcircleblock">
    <div class="loopcircle2">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  <div class="loopblock">
    <div class="loop">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  <div class="loopblock2">
    <div class="loop2">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  <div class="loopblock3">
    <div class="loop3">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
  <div class="loopblock4">
    <div class="loop4">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
</div>
            
          
!
            
              /* This works best in chrome.

Pretty damn pleased I got this working on my own. It took forever.
Even though the joining part in the middle isn't quite perfect.

Edited to include the loop going behind in the middle.*/

:root {
  --colour1: #ef5350;
  --colour2: #ffb74d;
  --colour3: #fff176;
  --colour4: #80deea;
  --colour1a: #ffcdd2;
  --colour2a: #ffe0b2;
  --colour3a: #fff9c4;
  --colour4a: #e0f7fa;

  --speed: 4.5s; /* 6 */
  /* 2-1   4-2  8-3 */
}

body {
  font-family: verdana;
  font-size: 12px;
  color: grey;
  background-color: #f5f5f5;
}

.world {
  position: absolute;
  margin: auto;
  top: 0px;
  bottom: 0;
  left: 0;
  right: 0;
  width: 400px;
  height: 240px;
}
.bottomline {
  position: absolute;
  letter-spacing: 2px;
  font-family: "verdana";
  font-size: 12px;
  text-align: center;
  top: 330px;
  width: 400px;
  height: 40px;
  z-index: 99;
  color: lightgrey;
}
a {
  position: relative;
  letter-spacing: 2px;
  font-family: "verdana";
  font-size: 12px;
  color: var(--colour4);
  text-decoration: none;
}
.controls {
  position: absolute;
  width: 400px;
  text-align: center;
  top: 260px;
  width: 400px;
  font-size: 20px;
  color: lightgrey;
}
#speed {
  transform: rotate(180deg) translateY(-8px);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
}
input[type="range"] {
  -webkit-appearance: none;
  width: 400px;
  background: white;
}
input[type="range"]::-webkit-slider-thumb {
  height: 20px;
  width: 16px;
  background: lightgrey;
  cursor: pointer;
}
/* LOOP CIRCLE POSITIONS */
/* LOOP CIRCLE POSITIONS */
/* LOOP CIRCLE POSITIONS */
/* LOOP CIRCLE POSITIONS */
/* LOOP CIRCLE POSITIONS */

.loopblock {
  position: absolute;
  width: 400px;
  height: 120px;
  overflow: hidden;
  animation: opacity var(--speed) linear infinite;
}
.loopblock2 {
  position: absolute;
  top: 0px;
  width: 400px;
  height: 120px;
  transform: rotate(180deg) translateX(160px) translateY(-120px);
  overflow: hidden;
  animation: opacity var(--speed) linear calc(var(--speed) / -4) infinite;
}
.loopblock3 {
  position: absolute;
  top: 0px;
  width: 400px;
  height: 120px;
  overflow: hidden;
  animation: opacity var(--speed) linear calc(var(--speed) / -2) infinite;
}
.loopblock4 {
  position: absolute;
  top: 0px;
  width: 400px;
  height: 120px;
  overflow: hidden;
  transform: rotate(180deg) translateX(-160px) translateY(-120px);
  animation: opacity var(--speed) linear calc((var(--speed) / -4) * 3) infinite;
}
.loopcircleblock {
  position: absolute;
  top: 0px;
  width: 400px;
  height: 120px;
  overflow: hidden;
  transform: rotate(180deg) translateX(-160px) translateY(-120px);
  animation: z2 var(--speed) linear infinite;
}
.loopcircleblock2 {
  position: absolute;
  top: 0px;
  width: 400px;
  height: 120px;
  overflow: hidden;
  animation: z1 var(--speed) linear infinite;
}

/* LOOP CIRCLES AS FAINT BACKGROUND */
/* LOOP CIRCLES AS FAINT BACKGROUND */
/* LOOP CIRCLES AS FAINT BACKGROUND */
/* LOOP CIRCLES AS FAINT BACKGROUND */
/* LOOP CIRCLES AS FAINT BACKGROUND */

.loopcircle span {
  position: absolute;
  height: 200px;
  width: 200px;
  border-radius: 100%;
  border-style: solid;
  border-color: var(--colour1a);
  border-width: 20px;
}
.loopcircle span:nth-child(2) {
  height: 160px;
  width: 160px;
  left: 20px;
  top: 20px;
  border-color: var(--colour2a);
}
.loopcircle span:nth-child(3) {
  height: 120px;
  width: 120px;
  left: 40px;
  top: 40px;
  border-color: var(--colour3a);
}
.loopcircle span:nth-child(4) {
  height: 80px;
  width: 80px;
  left: 60px;
  top: 60px;
  border-color: var(--colour4a);
}
.loopcircle2 span {
  position: absolute;
  left: 160px;
  height: 200px;
  width: 200px;
  border-radius: 100%;
  border-style: solid;
  border-color: var(--colour4a);
  border-width: 20px;
}
.loopcircle2 span:nth-child(2) {
  height: 160px;
  width: 160px;
  left: 180px;
  top: 20px;
  border-color: var(--colour3a);
}
.loopcircle2 span:nth-child(3) {
  height: 120px;
  width: 120px;
  left: 200px;
  top: 40px;
  border-color: var(--colour2a);
}
.loopcircle2 span:nth-child(4) {
  height: 80px;
  width: 80px;
  left: 220px;
  top: 60px;
  border-color: var(--colour1a);
}
.loopcircle3 span {
  position: absolute;
  left: 160px;
  height: 200px;
  width: 200px;
  border-radius: 100%;
  border-style: solid;
  border-color: var(--colour4a);
  border-width: 20px;
}
.loopcircle3 span:nth-child(2) {
  height: 160px;
  width: 160px;
  left: 180px;
  top: 20px;
  border-color: var(--colour3a);
}
.loopcircle3 span:nth-child(3) {
  height: 120px;
  width: 120px;
  left: 200px;
  top: 40px;
  border-color: var(--colour2a);
}
.loopcircle3 span:nth-child(4) {
  height: 80px;
  width: 80px;
  left: 220px;
  top: 60px;
  border-color: var(--colour1a);
}

/* ANIMATED LOOPS */
/* ANIMATED LOOPS */
/* ANIMATED LOOPS */
/* ANIMATED LOOPS */
/* ANIMATED LOOPS */

.loop span {
  position: absolute;
  height: 100px;
  width: 100px;
  border-radius: 100% 0;
  border-style: solid;
  border-color: var(--colour1);
  border-width: 20px 0 0 20px;
  transform-origin: bottom right;
  transform: rotate(-270deg);
  animation: spinleft calc(var(--speed)/2) linear infinite;
  border-bottom-right-radius: 80%;
}
.loop span:nth-child(2) {
  height: 80px;
  width: 80px;
  left: 20px;
  top: 20px;
  border-color: var(--colour2);
}
.loop span:nth-child(3) {
  height: 60px;
  width: 60px;
  left: 40px;
  top: 40px;
  border-color: var(--colour3);
}
.loop span:nth-child(4) {
  height: 40px;
  width: 40px;
  left: 60px;
  top: 60px;
  border-color: var(--colour4);
}
.loop2 span {
  position: absolute;
  height: 100px;
  width: 100px;
  border-radius: 100% 0;
  border-style: solid;
  border-color: var(--colour1);
  border-width: 20px 0 0 20px;
  transform-origin: bottom right;
  transform: rotate(-270deg);
  animation: spinleft calc(var(--speed)/2) linear calc(var(--speed) / -4)
    infinite;
  border-bottom-right-radius: 80%;
}
.loop2 span:nth-child(2) {
  height: 80px;
  width: 80px;
  left: 20px;
  top: 20px;
  border-color: var(--colour2);
}
.loop2 span:nth-child(3) {
  height: 60px;
  width: 60px;
  left: 40px;
  top: 40px;
  border-color: var(--colour3);
}
.loop2 span:nth-child(4) {
  height: 40px;
  width: 40px;
  left: 60px;
  top: 60px;
  border-color: var(--colour4);
}
.loop3 span {
  position: absolute;
  top: 0px;
  left: 160px;
  height: 100px;
  width: 100px;
  border-radius: 100% 0;
  border-style: solid;
  border-color: var(--colour4);
  border-width: 20px 0 0 20px;
  transform-origin: bottom right;
  animation: spinright calc(var(--speed)/2) linear infinite;
  border-bottom-right-radius: 80%;
}
.loop3 span:nth-child(2) {
  height: 80px;
  width: 80px;
  left: 180px;
  top: 20px;
  border-color: var(--colour3);
}
.loop3 span:nth-child(3) {
  height: 60px;
  width: 60px;
  left: 200px;
  top: 40px;
  border-color: var(--colour2);
}
.loop3 span:nth-child(4) {
  height: 40px;
  width: 40px;
  left: 220px;
  top: 60px;
  border-color: var(--colour1);
}

.loop4 span {
  position: absolute;
  top: 0px;
  left: 160px;
  height: 100px;
  width: 100px;
  border-radius: 100% 0;
  border-style: solid;
  border-color: var(--colour4);
  border-width: 20px 0 0 20px;
  transform-origin: bottom right;
  animation: spinright calc(var(--speed)/2) linear calc(var(--speed) / -4)
    infinite;
  border-bottom-right-radius: 80%;
}
.loop4 span:nth-child(2) {
  height: 80px;
  width: 80px;
  left: 180px;
  top: 20px;
  border-color: var(--colour3);
}
.loop4 span:nth-child(3) {
  height: 60px;
  width: 60px;
  left: 200px;
  top: 40px;
  border-color: var(--colour2);
}
.loop4 span:nth-child(4) {
  height: 40px;
  width: 40px;
  left: 220px;
  top: 60px;
  border-color: var(--colour1);
}
@keyframes spinleft {
  0% {
    transform: rotate(-90deg);
  }
  100% {
    transform: rotate(270deg);
  }
}
@keyframes spinright {
  0% {
    transform: rotate(180deg);
  }
  100% {
    transform: rotate(-180deg);
  }
}
@keyframes opacity {
  0%,
  40% {
    opacity: 1;
  }
  40.1%,
  100% {
    opacity: 0;
  }
}
@keyframes opacity2 {
  0%,
  24.9%,
  75.1%,
  100% {
    opacity: 0;
  }
  25%,
  75% {
    opacity: 1;
  }
}
@keyframes z1 {
  0%,
  64.9% {
    z-index: 0;
  }
  65%,
  100% {
    z-index: 8;
  }
}
@keyframes z2 {
  0%,
  74.9% {
    z-index: 0;
  }
  75%,
  100% {
    z-index: 10;
  }
}

            
          
!
            
              //code borrowed from another codepen: https://codepen.io/kathykato/pen/rwNqjP*//

const inputs = document.querySelectorAll('.controls input');

function handleUpdate() {
  const suffix = this.dataset.sizing || '';
  document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix);
}

inputs.forEach(input => input.addEventListener('change', handleUpdate));
inputs.forEach(input => input.addEventListener('mousemove', handleUpdate));
            
          
!
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