Pen Settings

HTML

CSS

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

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

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.

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

              
                <div class="outer-wrapper delay">
  <div class="inner-wrapper">
<svg id="die-2" xmlns="http://www.w3.org/2000/svg" width="139" height="139" viewBox="0 0 139 139">
  <g id="dice-face-2" transform="translate(-163 -4571)">
    <rect id="Rectangle_60" data-name="Rectangle 60" width="139" height="139" transform="translate(163 4571)" fill="#6f3edb"/>
    <circle id="Ellipse_11" data-name="Ellipse 11" cx="14" cy="14" r="14" transform="translate(185 4593)" fill="#f9f2db"/>
    <circle id="Ellipse_13" data-name="Ellipse 13" cx="14" cy="14" r="14" transform="translate(185 4659)" fill="#f9f2db"/>
    <circle id="Ellipse_14" data-name="Ellipse 14" cx="14" cy="14" r="14" transform="translate(251 4593)" fill="#f9f2db"/>
    <circle id="Ellipse_12" data-name="Ellipse 12" cx="14" cy="14" r="14" transform="translate(251 4659)" fill="#f9f2db"/>
  </g>
</svg>
  </div>
</div>

<div class="outer-wrapper">
  <div class="inner-wrapper">
<svg id="die-1" xmlns="http://www.w3.org/2000/svg" width="139" height="139" viewBox="0 0 139 139">
  <g id="dice-face-1" transform="translate(-163 -4571)">
    <rect id="Rectangle_60" data-name="Rectangle 60" width="139" height="139" transform="translate(163 4571)" fill="#6f3edb"/>
    <circle id="Ellipse_11" data-name="Ellipse 11" cx="14" cy="14" r="14" transform="translate(185 4593)" fill="#f9f2db"/>
    <circle id="Ellipse_13" data-name="Ellipse 13" cx="14" cy="14" r="14" transform="translate(185 4659)" fill="#f9f2db"/>
    <circle id="Ellipse_14" data-name="Ellipse 14" cx="14" cy="14" r="14" transform="translate(251 4593)" fill="#f9f2db"/>
    <circle id="Ellipse_15" data-name="Ellipse 15" cx="14" cy="14" r="14" transform="translate(219 4627)" fill="#f9f2db"/>
    <circle id="Ellipse_12" data-name="Ellipse 12" cx="14" cy="14" r="14" transform="translate(251 4659)" fill="#f9f2db"/>
  </g>
</svg>
  </div>
</div>


              
            
!

CSS

              
                :root {
  --anim-length: 2.5s;
}

body {
  width: 50vw;
  margin: auto;
  height: 300px;
  border: 1px solid #7931E3;
  position: relative;
}

.outer-wrapper.delay {
  --delay: 0.2s;
  animation-name: bounce-outer-delayed;
  
  .inner-wrapper {
    animation-name: bounce-inner-delayed;
  }
}

.outer-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  --delay: 0s;
  height: 100%;
  width: 100px;
  animation: bounce-outer var(--anim-length) linear infinite;
  animation-delay: var(--delay);
  
  .inner-wrapper {
    height: 100px;
    width: 100px;
    position: absolute;
    bottom: 0;
    left: 0;
    animation: bounce-inner var(--anim-length) ease-in infinite; 
  animation-delay: var(--delay);
    
    svg {
      width: 100%;
      height: 100%;
      animation: spin var(--anim-length) linear infinite;
      animation-delay: var(--delay);
    }
    
    &::before {
      content: '';
      position: absolute;
      top: 6px;
      left: -6px;
      width: 100%;
      height: 100%;
      background: #FAF1D8;
      outline: 3px solid #7931E3;
      outline-offset: -3px;
      animation: spin var(--anim-length) linear infinite, spin-offset var(--anim-length) linear infinite;
      animation-delay: var(--delay);
    }
  }
}

@keyframes bounce-outer {
  50% {
    transform: translateX(calc(50vw - 100%));
  }
  70% {
    transform: translateX(calc(40vw - 100%));
    animation-timing-function: ease-out;
  }
  80%, 100% {
    transform: translateX(calc(38vw - 100%));
  }
}

@keyframes bounce-outer-delayed {
  50% {
    transform: translateX(calc(50vw - 100%));
  }
  70% {
    transform: translateX(calc(43vw - 100%));
    animation-timing-function: ease-out;
  }
  80%, 100% {
    transform: translateX(calc(42vw - 100%));
  }
}

@keyframes bounce-inner {
  0%, 20%, 40%, 60% {
    transform: translateY(-10px);
    animation-timing-function: ease-out;
  }
  10% {
    transform: translateY(-100px);
  }
  30% {
    transform: translateY(-90px);
  }
  50% {
    transform: translateY(-80px);
  }
  65% {
    transform: translateY(-20px);
  }
  70%, 100% {
    transform: translateY(0);
  }
}

@keyframes bounce-inner-delayed {
  0%, 20%, 40%, 60% {
    transform: translateY(-10px);
    animation-timing-function: ease-out;
  }
  10% {
    transform: translateY(-160px);
  }
  30% {
    transform: translateY(-130px);
  }
  50% {
    transform: translateY(-120px);
  }
  65% {
    transform: translateY(-30px);
  }
  70%, 100% {
    transform: translateY(0);
  }
}

@keyframes spin {
  20% {
    transform: rotate(200deg);
  }
  40% {
    transform: rotate(400deg);
  }
  50% {
    transform: rotate(500deg);
  }
  60% {
    transform: rotate(330deg);
  }
  70%, 100% {
    transform: rotate(360deg);
  }
}

@keyframes spin-offset {
  10%, 30% {
   top: -6px; 
   left: -6px;
  }
  20%, 40% {
    top: 6px;
    left: -6px;
  }
  50%, 100% {
    top: -6px;
    left: 6px;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console