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.

            
              .container
  .egg
   - var legs = 0
   ul
    while legs < 7
      -legs++
      li
    .face
      .eyes
      .smile
      .cheeks
      .shine
  .shadow(id="egg-shadow")
  .heart
    .light
  .ghost
    - var legs = 0
    ul
      while legs < 9
        -legs++
        li
    .face
      .eyes
      .smile
      .cheeks
  .shadow(id="ghost-shadow")

            
          
!
            
              $background: #48befe;
$body: #fdfeff;
$bodyWidth: 175px;
$bodyHeight: 220px;
$yolk: #ffdb10;
$cheeks: #ff7e7e;
$duration: 0.7s;
$heartSize: 30px;

@mixin characters {
  width: $bodyWidth;
  height: $bodyHeight;
  border-radius: 100px 100px 0px 0px;
  background: $body;
  position: relative;
  display: inline-block;
}

body {
  background: $background;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
}

.container {
  position: absolute;
  white-space: nowrap;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
ul {
  margin: 0;
  padding: 0;
  li {
    list-style: none;
  }
}

// Egg Yolk
.egg {
  @include characters;
  animation: floating 5s ease-out infinite;
  left: -5%;
  .face {
    width: 130px;
    height: 130px;
    background: $yolk;
    position: absolute;
    margin: 15% 15%;
    border-radius: 100%;
    box-shadow: inset -10px 1px 0 #ffcc24;
    .eyes {
      width: 15px;
      height: 15px;
      background: #000;
      border-radius: 100%;
      position: relative;
      top: 55px;
      left: 38px;
      animation: blink 3s infinite 2s;
      &::after {
        content: "";
        width: 15px;
        height: 15px;
        position: absolute;
        background: #000;
        border-radius: 100%;
        left: 50px;
      }
    }
    .smile {
      position: relative;
      border-bottom-left-radius: 90px;
      border-bottom-right-radius: 90px;
      width: 30px;
      height: 15px;
      background: #000;
      left: 55px;
      top: 60px;
      &::after {
        content: "";
        position: absolute;
        width: 10px;
        height: 5px;
        background: $cheeks;
        border-radius: 100%;
        left: 10px;
        top: 8px;
      }
    }
    .cheeks {
      position: relative;
      width: 12px;
      height: 12px;
      background: $cheeks;
      border-radius: 100%;
      opacity: 0.5;
      top: 40px;
      left: 30px;
      &::after {
        content: "";
        position: absolute;
        width: 12px;
        height: 12px;
        background: $cheeks;
        border-radius: 100%;
        left: 67px;
      }
    }
    .shine {
      position: relative;
      width: 8px;
      height: 20px;
      background: $body;
      border-radius: 200px;
      top: -10px;
      left: 12px;
      transform: rotate(20deg);
      &::after {
        position: absolute;
        content: "";
        width: 8px;
        height: 8px;
        background: $body;
        border-radius: 200px;
        top: -15px;
        left: 6px;
      }
    }
  }
  ul {
    display: flex;
  }
  li {
    position: relative;
    border-radius: 200px;
  }
  li:nth-child(odd) {
    background: $body;
  }
  li:nth-child(even) {
    background: $background;
  }
  li:nth-child(1) {
    width: 30px;
    height: 60px;
    top: 175px;
    animation: anim1 1.5s ease-out infinite;
  }
  li:nth-child(2) {
    width: 20px;
    height: 50px;
    top: 185px;
    animation: anim2 3s ease-out infinite;
  }
  li:nth-child(3) {
    width: 28.5px;
    height: 60px;
    top: 195px;
    animation: anim3 1s ease-in-out infinite;
  }
  li:nth-child(4) {
    width: 20px;
    height: 50px;
    top: 210px;
    animation: anim4 2.2s ease-out infinite;
  }
  li:nth-child(5) {
    width: 28.5px;
    height: 60px;
    top: 190px;
    animation: anim3 1.5s ease-out infinite;
  }
  li:nth-child(6) {
    width: 20px;
    height: 60px;
    top: 200px;
    animation: anim2 4s ease-out infinite;
  }
  li:nth-child(7) {
    width: 28.5px;
    height: 60px;
    top: 190px;
    animation: anim1 1.5s ease-out infinite;
  }
}

// Ghost
.ghost {
  @include characters;
  animation: floating 2s ease-out infinite;
  opacity: 0.75;
  left: 5%;
  &::before {
    content: "";
    @include characters;
    position: absolute;
    box-shadow: inset -15px 1px 0px #efefef;
  }
  .face {
    width: 130px;
    height: 130px;
    background: transparent;
    position: absolute;
    margin: -20% 10%;
    border-radius: 100%;
    .eyes {
      opacity: 0.5;
      width: 15px;
      height: 15px;
      background: #000;
      border-radius: 100%;
      position: relative;
      top: 55px;
      left: 3px;
      animation: blink 5s infinite;
      &::after {
        content: "";
        width: 15px;
        height: 15px;
        position: absolute;
        background: #000;
        border-radius: 100%;
        left: 50px;
      }
    }
    .smile {
      position: relative;
      opacity: 0.5;
      border-bottom-left-radius: 50px;
      border-bottom-right-radius: 50px;
      width: 10px;
      height: 6px;
      background: transparent;
      border: 5px solid #000;
      left: 25px;
      top: 55px;
      &::before {
        background: $body;
        width: 30px;
        height: 7px;
        content: "";
        position: absolute;
        left: -10px;
        top: -5.5px;
      }
    }
    .cheeks {
      position: relative;
      width: 12px;
      height: 12px;
      background: $cheeks;
      border-radius: 100%;
      opacity: 0.5;
      top: 43px;
      left: -4px;
      &::after {
        content: "";
        position: absolute;
        width: 12px;
        height: 12px;
        background: $cheeks;
        border-radius: 100%;
        left: 67px;
      }
    }
  }
  ul {
    display: flex;
  }
  li {
    position: relative;
    border-radius: 200px;
    height: 60px;
  }
  li:nth-child(odd) {
    background: $body;
    width: 30px;
    top: 172px;
    z-index: -1;
  }
  li:nth-child(even) {
    background: $background;
    width: 7px;
    top: 215px;
  }
  li:nth-child(1) {
    animation: ghostani 3s ease-out infinite;
  }
  li:nth-child(3) {
    animation: ghostani 3s ease-out infinite 0.5s;
  }
  li:nth-child(5) {
    animation: ghostani 3s ease-out infinite 1.0s;
  }
  li:nth-child(7) {
    animation: ghostani 3s ease-out infinite 1.5s;
  }
  li:nth-child(9) {
    box-shadow: inset -15px 4px #efefef;
    animation: ghostani 3s ease-out infinite 2s;
  }
}

.heart {
  position: absolute;
  display: inline-block;
  width: $heartSize;
  height: $heartSize;
  background: red;
  left: 45%;
  transform: rotate(45deg);
  animation: beat $duration linear infinite;
  &::before {
    position: absolute;
    content: "";
    width: $heartSize;
    height: $heartSize;
    background: red;
    border-radius: 100%;
    top: -50%;
    animation: beat $duration linear infinite;
  }
  &::after {
    @extend .heart::before;
    top: 0%;
    left: -50%;
  }
  .light {
    width: 5px;
    height: 12px;
    background: white;
    position: absolute;
    border-radius: 200px;
    z-index: 3;
    left: -11px;
    top: 13px;
    transform: rotate(-10deg);
    animation: lightshift $duration linear infinite;
    &::after {
      content: "";
      position: absolute;
      z-index: 3;
      width: 5px;
      height: 5px;
      background: white;
      border-radius: 200px;
      top: -5px;
      left: 1.5px;
    }
  }
}

.shadow {
  position: absolute;
  opacity: 0.2;
  width: 180px;
  height: 15px;
  background: #000;
  top: 275px;
  border-radius: 100%;
}
.shadow#egg-shadow {
  left: -20px;
  animation: shadow-ani 5s ease-out infinite;
}
.shadow#ghost-shadow {
  left: 195px;
  transform-origin: center;
  animation: shadow-ani 2s ease-out infinite;
}
@keyframes shadow-ani {
  50% {
    width: 170px;
    height: 10px;
  }
}
@keyframes blink  {
	0%{
		transform:scaleY(1)
	}	
	18%{
		transform:scaleY(1)
	}
	20%{
		transform:scaleY(0)
	}	
	25%{
		transform:scaleY(1)
	}	
	38%{
		transform:scaleY(1)
	}	
	40%{
		transform:scaleY(0)
	}	
	45%{
		transform:scaleY(1)
	}
	80% {
		transform:scaleY(1)
	}
}
@keyframes beat {
  20%,
  40% {
    height: $heartSize + 10;
    width: $heartSize + 10;
  }
}
@keyframes lightshift {
  20%,
  40% {
    left: -15px;
  }
}
@keyframes floating {
  0% {
    top: 0;
  }
  50% {
    top: -10px;
  }
  100% {
    top: 0;
  }
}

@keyframes anim1 {
  50% {
    top: 180px;
  }
}

@keyframes anim2 {
  50% {
    top: 178px;
  }
}

@keyframes anim3 {
  50% {
    top: 205px;
  }
}

@keyframes anim4 {
  50% {
    top: 205px;
  }
}

@keyframes ghostani {
  50% {
    top: 180px;
  }
}
            
          
!
            
              /* Thanks to the following: https://codepen.io/hmps/pen/Cfjzh */
            
          
!
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.

Console