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.

            
              %p <strong>Click</strong> a button to activate its animation.
.btn-container
  %button.btn.btn--shockwave.is-active
    Shockwave
  %button.btn.btn--jump
    Jump
  %button.btn.btn--pulse
    Pulse
  %button.btn.btn--blink
    Blink
  %button.btn.btn--wiggle
    Wiggle
  %button.btn.btn--wut
    Hatching Alien
            
          
!
            
              $spacing__base: 1.6rem;
$easing: cubic-bezier(.33,.33,.33,1);
$background:  darken(#daecf3, 12);
$gradient_end: darken(#D7EDEC, 8);

@mixin afterBg {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  border-radius: 50%;
}

body {
    max-width: 600px;
    margin: $spacing__base * 3 auto;
    background: $background;
    font-family: tahoma, helvetica neue, helvetica, arial, sans-serif;
    background: -webkit-linear-gradient(to right, $background, $gradient_end);
    background: linear-gradient(to right, $background, $gradient_end);
    text-align: center;
   
}

.btn-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
}

.btn {
  width: $spacing__base * 4;
  line-height: $spacing__base * 4;
  background: #fff;
  border-radius: 50%;
  text-align: center;
  margin: $spacing__base;
  font-size: 0.8rem;
  border: none;
  padding: 0;
  position: relative;
  // MAKE SURE YOU HAVE AN ACCESSIBE FOCUS STATE
  outline: none;
}

// Shockwave
.btn--shockwave.is-active {
  animation: shockwaveJump 1s ease-out infinite;
  
  &:after {
    @include afterBg;
    animation: shockwave 1s .65s ease-out infinite;
  }
  
  &:before {
    @include afterBg;
    animation: shockwave 1s .5s ease-out infinite;
  }
}

@keyframes shockwaveJump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
  }
  50% {
     transform: scale(0.98);
  }
  55% {
    transform: scale(1.02);
  }
  60% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shockwave {
  0% {
    transform: scale(1);
    box-shadow: 0 0 2px rgba(0,0,0,0.15), inset 0 0 1px rgba(0,0,0,0.15);
  }
  95% {
    box-shadow: 0 0 50px rgba(0,0,0,0), inset 0 0 30px rgba(0,0,0,0);
  }
  100% {
    transform: scale(2.25);

  }
}

// JUMP
.btn--jump.is-active {
  animation: .4s jump ease infinite alternate;
}

@keyframes jump {
  0% {
    transform: scale(1);
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
  }
  100% {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
  }
}

// PULSE
.btn--pulse.is-active {
  background: transparent;
  
  &:after {
    @include afterBg;
    background: #fff;
    animation: pulse 0.4s ease infinite alternate;
    z-index: -1;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 2px rgba(0,0,0,.2);
    border-radius: 50%;
  }
  100% {
    transform: scale(1.05);
    box-shadow: 0 2px 2px rgba(0,0,0,.2);
    border-radius: 45%;
  }
}


// BLINK
.btn--blink.is-active {
  background: transparent;
  
  &:after {
    @include afterBg;
    background: #fff;
    animation: blink 1.33s ease-out infinite;
    z-index: -1;
  }
}

@keyframes blink {
  0% {
    opacity: 1;
  }
  20% {
    opacity: .5;
  }
  100% {
    opacity: 1;
  }
}

// Wiggle
.btn--wiggle.is-active {
  animation: 1s wiggle ease infinite;
}

@keyframes wiggle {
  0% {
    transform: rotate(-3deg);
    box-shadow: 0 2px 2px rgba(0,0,0,.2);
  }
  20% {
    transform: rotate(20deg);
  }
  40% {
    transform: rotate(-15deg);
  }
  60% {
    transform: rotate(5deg);
  }
  90% {
    transform: rotate(-1deg);
  }
  100% {
    transform: rotate(0);
    box-shadow: 0 2px 2px rgba(0,0,0,.2);
  }
}


// WUT
.btn--wut.is-active {
  animation: 1s fullRotation ease infinite;
  
  &:before {
    @include afterBg;
    background: #fff;
    animation: wutBefore 0.8s .4s ease-out infinite;
    z-index: -1;
  }
  
  &:after {
    @include afterBg;
    background: #fff;
    animation: wut 0.8s ease-out infinite;
    z-index: -1;
  }
}

@keyframes fullRotation {
  0% {
    transform: rotate(-3deg) scale(1) translate3d(0,0,0);
  }
  20% {
    transform: rotate(50deg)  translate3d(0,5px,0);
  }
  40% {
    transform: rotate(-15deg) scale(1.1) translate3d(0,8px,-5px);
  }
  60% {
    transform: rotate(5deg) translate3d(5px,-8px,-80px);
  }
  90% {
    transform: rotate(-1deg) translate3d(0,0,0);
  }
  100% {
    transform: rotate(0);
  }
}

@keyframes wut {
  0% {
    border-radius: 50%;
    transform: skew(0) translate3d(0, 0px, 0px);
  }
  10% {
    transform: translate3d(0, -10px, 0);
  }
  50% {
    border-radius: 50%;
  }
  80% {
    border-radius: 30%;
    transform: translate3d(20, 10px, 20px);
  }
  100% {
    border-radius: 50%;
    transform: skew(0) translate3d(0, 0px, 0px);
  }
}

@keyframes wutBefore {
  0% {
    border-radius: 50%;
    transform: translate3d(0, 0px, 0px);
  }
  10% {
    transform: translate3d(-10px, 10px, 0);
  }
  70% {
     border-radius: 50%;
  }
  80% {
    border-radius: 30%;
    transform: translate3d(-20px, -10px, -20px);
  }
  100% {
    border-radius: 50%;
    transform: translate3d(0, 0px, 0px);
  }
}
            
          
!
            
              document.addEventListener('click', click);

function click(e) {
  let el
  
  el = e.target
  
  if (el !== e.currentTarget) {
    if(el.nodeName === 'BUTTON') {
      
       if(el.classList.contains('is-active')) {
         el.classList.remove('is-active')
       } else {
         el.classList.add('is-active')
       }
    }
  }
  event.stopPropagation()
}
            
          
!
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