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.

            
              %button Restart animation
.wrapper
 .head--top
  .hair--right
  .hair--left
  .ear--left
  .ear--right
  .eye--left
  .eye--right
 .head--bottom
  .nose
  .mouth
  .greeting hi!
            
          
!
            
              $mainColour: #DDECF4;
$black: black;

@mixin center($width) {
  width: $width;
  left: 50%;
  margin-left: -$width/2;
}

html {
  background: black;
  height: 101%;
}

* {box-sizing: border-box}

button {
  margin: 5px;
  padding: 5px 10px;
  font-size: 1.3rem;
  cursor: pointer;
}

.wrapper {
  position: absolute;
  top: 40%; right: 0; bottom: 0; left: 0;
  animation: monkey-entrance 1s forwards;
}

[class^="head"] {
  position: absolute;
  border: 10px solid $mainColour;
  border-radius: 50%;
  
  &:before,
  &:after {
    content: "";
    z-index: 5;
    display: block;
    margin: 0 auto;
    background-color: $black;
    border-radius: 50%;
  }
}

.head {
  
  &--bottom {
    top: 50px;
    @include center(134px);
    height: 114px;
    
    &:after {
      position: relative;
      width: 100%;
      height: 100%;
    }
  }

  &--top {
    top: 0;
    @include center(108px);
    height: 94px;
    background-color: $mainColour;
    
    &:before {
      position: absolute;
      top: 5px;
      left: 0;
      width: 50%;
      height: 100%;
      border-radius: 32px 20px 0 54px / 40px 14px 0 54px;
    }
    
    &:after {
      position: absolute;
      top: 5px;
      right: 0;
      width: 50%;
      height: 100%;
      border-radius: 20px 32px 54px 0 / 14px 40px 54px 0;
    }
  }
}

[class^="hair"] {
  position: absolute;
  transform: translateY(0);
}

.hair {
  
  &--left {
    width: 46px;
    height: 10px;
    left: 19px;
    border-radius: 50%;
    box-shadow: 30px 3px 0 0 $mainColour inset;
    animation: hair-left 500ms 2s forwards cubic-bezier(1, 0, 0.755, 1.470); 
  }

  &--right {
    width: 38px;
    height: 20px;
    left: 46px;
    border-radius: 50%;
    box-shadow: 18px 3px 0 $mainColour inset;
    animation: hair-right 500ms 2.2s forwards cubic-bezier(1, 0, 0.755, 1.470);
  }
}

[class^="eye"] {
  z-index: 10;
  position: absolute;
  width: 13px; height: 13px;
  background-color: $mainColour;
  border-radius: 50%;
  
  &:before {
    content: "";
    position: absolute;
    width: 13px;
    height: 13px;
    background-color: black;
    animation: wink 4s infinite;
  }
}

.eye {
  
  &--left {
    top: 42px;
    left: 25px;
  }

  &--right {
    top: 40px;
    right: 25px;
  }
}

[class^="ear"] {
  z-index: -1;
  position: absolute;
  top: 29px;
  width: 50px;
  height: 50px;
  background-color: $black;
  border: 9px solid $mainColour;
  border-radius: 50%;
}

.ear {
  &--left { 
    left: 0;
    animation: ear-left 500ms 1s forwards cubic-bezier(1, 0, 0.755, 1.470);
  }
  
  &--right {
    right: 0;
    animation: ear-right 500ms 1.2s forwards cubic-bezier(1.000, 0.000, 0.000, 1.315);
  }
}

.nose {
  z-index: 10;
  position: absolute;
  top: 12px; left: 37px;
  width: 26px; height: 26px;
  background-color: #DC514B;
  border-radius: 50%;
}

.mouth {
  z-index: 10;
  position: absolute;
  top: 48px; right: 27px;
  width: 21px; height: 21px;
  background-color: $mainColour;
  border-radius: 50%;
  
  &:before {
    content: "";
    position: absolute;
    width: 21px;
    height: 21px;
    background-color: black;
    transform: translateY(-13px);
    animation: talk 3s 3s 1 forwards;
  }
}

.greeting {
  opacity: 0;
  position: absolute;
  top: -120px;
  right: -105px;
  padding: 15px 30px;
  border: 3px solid $mainColour;
  border-radius: 60%;
  font-size: 28px;
  color: $mainColour;
  animation: greeting 3s 3.1s;
  
  &:after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: -4px;
    width: 19px;
    height: 14px;
    border: solid $mainColour;
    border-width: 0 0 3px 3px;
    background-color: black;
    transform: rotate(-7deg) skewX(-30deg);
  }
}

@keyframes monkey-entrance {
  0% {
	transform:translateY(-100%);
    animation-timing-function: ease-in;
  }
  40% {
  	transform:translateY(30px);
    animation-timing-function: ease-out;
  }
  60% {
  	transform:translateY(-25px);
    animation-timing-function: ease-in;
  }
  80% {
  	transform:translateY(15px);
    animation-timing-function: ease-out;
  }
  90% {
  	transform:translateY(-7px);
    animation-timing-function: ease-in;
  }
  100% {
  	transform:translateY(0);
    animation-timing-function: ease-out;
  }
}

@keyframes wink {
  0%, 6%, 100% { transform: translateY(-13px); }
  3% { transform: translateY(0); }
}

@keyframes talk {
  0%, 8%, 16%, 100% { transform: translateY(-13px); }
  4%, 12% { transform: translateY(-1px); }
}

@keyframes ear-left {
  to { transform: translateX(-33px); }
}

@keyframes ear-right {
  to { transform: translateX(33px); }
}

@keyframes hair-left {
  to { transform: translateY(-16px) rotate(-20deg); }
}

@keyframes hair-right {
  to { transform: translateY(-17px) rotate(-1deg); } 
}

@keyframes greeting {
  0%, 100% { opacity: 0; }
  5%, 95% { opacity: 1; }
}



            
          
!
            
              $("button").on("click", function(){	
 $(".wrapper").appendTo("body");
});
            
          
!
999px
Loading ..................

Console