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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="stage">
  <div class="bb8">
    <div class="head">
      <div class="exclamation"></div>
      <div class="eye"></div>
      <div class="eye"></div>
      <div class="stripecontainer">
        <div class="b"></div>
        <div class="o"></div>
        <div class="lg1"></div>
        <div class="lg2"></div>
        <div class="odash"><div></div><div></div></div>
        <div class="odash"><div></div><div></div></div>
        <div class="dg"></div>
      </div>
      <div class="antenna">      
      </div>
    </div><br/>
    <div class="body">
      <div class="ball">
        <div class="seam"></div>
        <div class="seam"></div>
        <div class="seam"></div>
        <div class="seam"></div>
        <div class="decal"><div></div><div></div></div>
        <div class="decal"><div></div><div></div></div>
        <div class="decal"><div></div><div></div></div>
        <div class="decal"><div></div><div></div></div>
      </div>
      <div class="body-shadow"></div>
    </div>    
  </div>
  <div class="shadow"></div>
</div>
  <div class="scenery">
    <div class="rock"></div>
    <div class="rock"></div>
  </div>
              
            
!

CSS

              
                /* Based off this gif -> http://orig05.deviantart.net/8a1a/f/2015/195/f/0/bb8_animated_gif_by_blue_staple_studios-d9197jh.gif */

$bg: #a2c2a8;
$orange: #ed762d;
$whig: #dfdfdf;
$ligg: #bbb;
$medg: #999;
$darg: #666;

body {background:$bg; text-align:center; font-size:1vh; width:100%; max-width:100%; overflow:hidden;}

div, ::after, ::before {display:inline-block;}

::after, ::before {position:absolute;}

.stage {
  position:relative;
  top: 20vh;
}
.bb8 {
  position:absolute;
  margin-left:-12em;
  
  .head {
    height:8em;
    width:16em;
    border-radius: 8em 8em 0 0;
    position:relative;
    -web-kit-perspective: 600;
    animation: 3s headroll infinite linear, 4S headbounce infinite linear;
    z-index:5;
    .eye {
      border-radius:80em;
      background:#000;
      height:2.7em;
      width:2.7em;
      position:absolute;
      z-index:5;
      top:3em;
      right:2.5em;
      box-shadow: -.5em 0 rgba(0,0,0,.3);
      animation: 4s eyeaim infinite linear;
      &::before, &::after {
        content:"";
        background:#fff;
        border-radius:80em;
        height:.9em;
        width:.9em;
      }
      &::before {
        top:.5em;
        left:.6em;
        animation: 4s eyegleammajor infinite linear;
      }
      &::after {
        top:3em;
        left:3em;
        font-size:.5em;
        animation: 4s eyegleamminor infinite linear;
      }
      ~.eye {
        font-size:.55em;
        top:9em;
        right:1.3em;
      }
    }
    .stripecontainer {
      z-index:3;
      background:$whig;
      width:100%;
      height:100%;
      height:8em;
      width:16em;
      border-radius: 8em 8em 0 0;
      overflow:hidden;
      position:relative;
      >div {
        left:0;
        width:250%;
        position:absolute;
        animation: 4s headaim infinite linear;
      }
    }
    .b {background:#5D62A3; height:.8em; top:1.3em;}
    .o {background:$orange; height:.4em; top:3em;}
    .lg1,.lg2 {background:$ligg; height:.1em; top:.5em;}
    .lg2 {top:6em;}
    .dg {background:$darg; height:.5em; top: 7.3em;}
    .odash {
      background:$orange; height:.5em; top: 6.7em; width:67% !important;
      overflow:hidden;
      +.odash {
        margin-left:95%;
      }
      div, div::after {
        position:absolute;
        height:100%;
        width: .5em;
        border: 1em solid $whig;
        border-width: 0 .4em;
        left:1em;
        +div {
          left: 7.2em;
        }
      }      
      div::after {
        content:"";
        left: 2.3em;
      }
    }
    .antenna {
      position:absolute;
      z-index: 2;
      top:0;
      margin-top:-5em;
      left:0;
      margin-left: 1.7em;
      transform: rotate3d(1, 0, 0, 25deg);
      animation: 4s antennamove infinite linear;
      &::before {
        position:absolute;
        top:-1.8em;
        left:-4.1em;
        content:"";
        height: 15em;
        width: 5em;
        border: 1em solid $whig;
        border-width: .4em;
        border-radius: 5em/14em;
        border-color: transparent $whig transparent transparent;
        animation: 4s antennabend infinite linear;
      }
      &::after {
        content:"";
        background:$whig;
        width: .8em;
        height:.8em;
        border-radius: 5em;
        position:absolute;
        top:-.6em;
        left:-.13em;
      }
    }
    .exclamation {
      opacity:0;
      animation: 4s exclamation infinite linear;
    }
    .exclamation, .exclamation::after, .exclamation::before {
      position:absolute;
      width: 1em;
      height: 5em;
      background: rgba(0,0,0,.1);
      top: -7em;
      left: 8em;
      border-radius: 5em;
    }
    .exclamation::after,.exclamation::before {
      content:"";
      top:2em;
    }
    .exclamation::after {
      left: -8em;
      transform: rotate(-30deg);
    }
    .exclamation::before {
      left: 8em;
      transform: rotate(30deg);
    }  
    
    &::after {
      content:"";
      border: 1em solid #000;
      border-width: .8em 1em;
      border-color: $medg transparent transparent transparent;
      bottom:-1.4em;
      left:0;
      width:14.2em;
      z-index:3;
    }
  }
  .body {
    .ball {
      background:$whig;  
      width: 24.2em;
      height: 24.2em;
      overflow:hidden;
      border-radius:50em;
      animation: 1s bodyroll infinite linear;
    }
    position:relative;
    z-index:2;
    width: 24em;
    height: 24em;
    top: -1.4em;
    left:0;
    border-radius:50em;
    overflow:hidden;
    animation: 4s bodybounce infinite linear;
    
    .decal, .seam {
      height: 10em;
      width: 10em;
      margin-left:-1.5em;
    }
    .decal {
      position:absolute;
      border: 1.1em solid $orange;
      border-radius:50em;
      background: $whig;
      z-index:3;
      
      &::after, &::before {
        content:"";
        background:$orange;
        height:1.8em;
        width:1.2em;
        position:absolute;
        top:1.1em;
        transform: rotate(45deg);
      }
      &::after {
        left:1.1em;
        width:1.8em;
        height:1.2em;
      }
      &::before {
        right:1.1em;
      }
      &:nth-child(4n+1) {
        top:6em;
        left:18em;
        transform:rotate(-90deg);
      }
      &:nth-child(4n+2) {
        top:18em;
        left:6em;
      }
      &:nth-child(4n+3) {
        top:6em;
        left:-6em;
        transform:rotate(90deg);
      }
      &:nth-child(4n+4) {
        top:-6em;
        left:6em;
        transform:rotate(180deg);
      }
      
      div:first-child {
        position:absolute;
        left:2.5em;
        top:2.5em;
        background:$darg;
        width: 5em;
        height: 5em;
        border-radius: 50em;
        
        &::before, &::after {
          content:"";
          border-radius: 50em;
          position:absolute;
          right: -2em;
          top: .2em;
          border: 2.5em solid $darg;
          border-color: transparent $darg transparent transparent;
          border-width: 2.5em 3em;
        }
        &::after {
          border-color: transparent transparent transparent $darg;
          left:-1.8em;
          top: -.3em;
          right:initial;
        }
      }
      div:last-child {
        &::before, &::after {
          content:"";
          border: .3em solid $whig;
          border-width: 0 .3em;
          width:.5em;
          height:6em;
          transform: rotate(35deg);
          position:absolute;
        }
        &::before {
          left: 3.8em;
          top: 1.5em;
        }
        &::after {
          left: 5.3em;
          top: 2.7em;
          border-left:0;
        }
      }
    }
    .seam {
      border: .3em solid $ligg;
      border-radius: 50em;
      position:absolute;
      top:-1em;
      left:-1em;
      &:nth-child(4n+1) {
        left:15em;
      }
      &:nth-child(4n+2) {
        top: 15em;
        left:15em;
      }
      &:nth-child(4n+4) {
        top:15em;
      }
    }
  }
  .body-shadow {
    position:absolute;
    width: 24em;
    height: 24em;
    bottom: -.1em;
    left:0em;
    border-radius:50em;
    overflow:hidden;
    z-index:5;
    border-bottom: 5em solid rgba(0,0,0,.15);
  }
}
.shadow {
  position:absolute;
  z-index:1;
  top:29.5em;
  left:0;
  margin-left:-12em;
  width: 24em;
	height: 2em;
	border-radius: 12em / 1em;
  background: rgba(0,0,0,.1);
  animation: 4s shadowshrink infinite linear;
}
.scenery {
  position:absolute;
  width:100%;
  top:49em;
  left:0;
  height: 20em;
  overflow:hidden;
}
.rock {
  position:absolute;
  top:0em;
  width:5em;
  height:4em;
  overflow:hidden;
  border-radius: 0 0 .8em .4em;
  box-shadow: 0 .3em rgba(0,0,0,.2);
  
  right:-5em;
  &::before, &::after {
    content:"";
    background: mix($darg,$bg,70%);
    width:5em;
    height:4em;
    bottom:-3.1em;
    left:0;
    transform:rotate(22deg);
  }
  &::after {
    width:3em;
    left:2em;
    bottom:-3em;
    transform:rotate(38deg);
  }
  
  animation: 4s scenery infinite linear;
  margin-right:-5em;
  +.rock {
    animation: 4s scenery infinite linear 2s;
    margin-top: 15em;
  }
}

@keyframes bodyroll {
  0% {transform:rotate(0deg);}
  100% {transform:rotate(360deg);}
}
@keyframes headroll {
  0% {transform:rotate(0deg);left:0;}
  25% {transform:rotate(5deg);left:1.2em;}
  75% {transform:rotate(-5deg);left:-1.2em;}
  100% {transform:rotate(0deg);left:0;}
}
@keyframes headbounce {
  0% 	  {margin-top:0;margin-bottom:0;}
  38% 	{margin-top:0;margin-bottom:0;}
  41% 	{margin-top:-12em;margin-bottom:12em;}
  44%	  {margin-top:0;margin-bottom:0;}
  46% 	{margin-top:-4em;margin-bottom:4em;}
  48% 	{margin-top:0;margin-bottom:0;}
  50% 	{margin-top:-1em;margin-bottom:1em;}
  52% 	{margin-top:0;margin-bottom:0;}
  100% 	{margin-top:0;margin-bottom:0;}
}
@keyframes bodybounce {
  0% 	{margin-top:0;			margin-bottom:0;}
  38% 	{margin-top:0;			margin-bottom:0;}
  41% 	{margin-top:-8em;		margin-bottom:8em;}
  44%	{margin-top:0;			margin-bottom:0;}
  46% 	{margin-top:-2em;		margin-bottom:2em;}
  48% 	{margin-top:0;			margin-bottom:0;}
  50% 	{margin-top:-1em;		margin-bottom:.1em;}
  52% 	{margin-top:0;			margin-bottom:0;}
  100% 	{margin-top:0;			margin-bottom:0;}
}
@keyframes eyeaim {
  0% 	  {margin-right:0;	box-shadow: -.5em 0 rgba(0,0,0,.2);}
  40% 	{margin-right:0;	box-shadow: -.5em 0 rgba(0,0,0,.2);}
  50% 	{margin-right:65%;	box-shadow: .5em 0 rgba(0,0,0,.2);}
  60% 	{margin-right:65%;	box-shadow: .5em 0 rgba(0,0,0,.2);}
  70% 	{margin-right:50%;	box-shadow: .3em 0 rgba(0,0,0,.2);}
  80% 	{margin-right:50%;	box-shadow: .3em 0 rgba(0,0,0,.2);}
  100% 	{margin-right:0;	box-shadow: -.5em 0 rgba(0,0,0,.2);}
}
@keyframes eyegleammajor {
  0% 	  {left:.5em;}
  40% 	{left:.5em;}
  50% 	{left:1.25em;}
  60% 	{left:1.25em;}
  70% 	{left:1em;}
  80% 	{left:1em;}
  100% 	{left:.5em;}
}
@keyframes eyegleamminor {
  0% 	  {left:3em;}
  40% 	{left:3em;}
  50% 	{left:1em;}
  60% 	{left:1em;}
  70% 	{left:1.3em;}
  80% 	{left:1.3em;}
  100% 	{left:3em;}
}
@keyframes headaim {
  0% 	{left:0;}
  40% 	{left:0;}
  50% 	{left:-60%;}
  60% 	{left:-60%;}
  70% 	{left:-50%;}
  80% 	{left:-50%;}
  100% 	{left:0;}
}
@keyframes antennamove {
  0% 	{left:0%;top:0;}
  36% {top:0;}
  40% 	{left:0%;top:2em;}
  43% 	{top:0;}
  46% 	{top:1.8em;}
  49% 	{top:0;}  
  50% 	{left:60%;}
  52% 	{top:0;}
  55% 	{top:.5em;}
  58% 	{top:0;}
  60% 	{left:60%;}
  70% 	{left:45%;}
  80% 	{left:45%;}
  100% 	{left:0%;}
}
@keyframes antennabend {
  0% 	{width:5em; border-radius: 5em/14em; margin-left:0;}
  40% 	{width:5em; border-radius: 5em/14em; margin-left:0;}
  48%   {height:15em;}
  50% 	{height:13em;width:8em; border-radius: 8em/14em; margin-left:-2.6em;}
  52% 	{height:15em;}
  55% 	{height:13em;}
  58% 	{height:15em;}
  60% 	{height:13em; width:8em; border-radius: 8em/14em; margin-left:-2.6em;}
  62% 	{height:15em;}
  70% 	{width:6.75em; border-radius: 6.75em/14em; margin-left:-1.45em;}
  80% 	{width:6.75em; border-radius: 6.75em/14em; margin-left:-1.45em;}
  100% 	{width:5em; border-radius: 5em/14em; margin-left:0;}
}
@keyframes shadowshrink {
  0% 	{width: 24em; height: 2em; border-radius: 12em / 1em; left:0;}
  38% 	{width: 24em; height: 2em; border-radius: 12em / 1em; left:0;}
  41% 	{width: 18em; height: 1.5em; border-radius: 9em / .75em; left:.5em;}
  44%	{width: 24em; height: 2em; border-radius: 12em / 1em; left:0;}
  46% 	{width: 21em; height: 1.75em; border-radius: 10.5em / .875em; left:.25em;}
  48% 	{width: 24em; height: 2em; border-radius: 12em / 1em; left:0;}
  100% 	{width: 24em; height: 2em; border-radius: 12em / 1em; left:0;}
}
@keyframes scenery {
  0% 	{right:-5em;}
  24% 	{right:-5em;}
  38% 	{right:50%;}
  52% 	{right:110vw;}
  100% 	{right:110vw;}
}
@keyframes exclamation {
  0% {opacity:0; font-size:1em; left:8em; top:-7em;}
  38% {opacity:0; font-size:1em; left:8em; top:-7em;}
  41% {opacity:1; font-size:1.5em; left:6em; top:-8.5em;}
  44% {opacity:0; font-size:2em; left:4em; top:-10em;}
  100% {opacity:0; font-size:1em; left:8em; top:-7em;}
}
              
            
!

JS

              
                
              
            
!
999px

Console