123

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.

            
              <div class="logo"></div>

<!--
this list is purely for positioning,
no wrapper necessary!
-->

<ul>
  <li><i class="ultraball"></i></li>
  <li><i class="masterball"></i></li>
  <li><i class="loveball"></i></li>
  <li><i class="greatball"></i></li>
  <li><i class="friendball"></i></li>
  <li class="block"><i class="pokeball"></i></li>
</ul>
            
          
!
            
              
$buttonShadow: 
  inset 0px 2px 0 rgba(0,0,0,0.3), 
  -4px -8px 4px -1px rgba(255,255,255,0.8);


// this mixin creates a normal, 
// red and white pokeball if
// not supplied any parameters.

@mixin pokeball(

  $top: #ED1C1C, 
  $bottom: #FFF, 
  $anim: 5s,
  $btnShadow: $buttonShadow 

) {
  
  // this is the "ball" , it uses a clever
  // radial gradient to do the colours
        
  width: 20px; height: 20px;
  border-radius: 100%;
  border: 1px solid #333;
  position: relative; display: inline-block;
  box-shadow: inset -3px 1px 1px rgba(0,0,0,0.2);
  
  background: radial-gradient( circle at top center, $top 45%, #555 46%, #555 52%, $bottom 53%);
  background-size: 200% 100%;
  background-position: 50%;
  
  transform-origin: center; 
  animation: pokewobble $anim ease infinite forwards;
  
  // this is the "shadow" under the ball, 
  // nothing too fancy here.
        
  &:before {
    content: ""; opacity: 0.3;
    position: absolute; bottom: -2px; left: 15%;
    width: 70%; height: 2px;
    border-radius: 50%; box-shadow: 0 0 2px 1px #000;
    background: #000; z-index: -1;
    
    transform-origin: center -10px; 
    animation: pokeshadow $anim ease infinite forwards;
  }
  
  // this is the "button" for the ball.
        
  &:after {
    content: "";
    position: absolute; left: 50%; top: 50%;
    width: 4px; height: 4px; border-radius: 100%;
    margin-left: -3px; margin-top: 1px;
    background: white; border: 1px solid #333;
    box-shadow: $btnShadow;
    
    animation: pokeglow $anim ease infinite forwards;
  }
          
}

// apply the mixin !!!
      
.pokeball { @include pokeball(); }

// extra parameters change top and bottom colours.

.loveball { @include pokeball( #ea7cc5 , #f2d7e9 ); }
.masterball { @include pokeball( #8633af , #eee ); }
.ultraball { @include pokeball( #777 , #eee ); }
.friendball { @include pokeball( #74c621 , #ddd ); }
.greatball { @include pokeball( #1aa5d8 , #eee ); }
      


      
// add some embelleshment to other balls.
// I got lazy so the other balls do not
// animate the "glowing" button because
// it would require a new animation for
// each ball.
      

// we apply a bunch of drop-shadows to the
// button for creating the extra bits
// on the balls.

$mcolor: #f28795;
.masterball:after {
   box-shadow:
          -4px -8px 4px -1px rgba(255,255,255,0.6) , 
          inset 0px 2px 0 rgba(0,0,0,0.3) ,
          -5px -9px 0 -1px #bf225b ,
          5px -9px 0 -1px #b22554,
          -3px -5px 0 -2px $mcolor,
          -3px -6px 0 -2px $mcolor,
          -2px -7px 0 -2px $mcolor,
          -1px -6px 0 -2px $mcolor,
          0px -5px 0 -2px $mcolor,
          1px -6px 0 -2px $mcolor,
          2px -7px 0 -2px $mcolor, 
          3px -5px 0 -2px $mcolor,
          3px -6px 0 -2px $mcolor;
   animation: none;
}
      
.greatball:after {
   box-shadow:
          -4px -8px 4px -1px rgba(255,255,255,0.6) , 
          inset 0px 2px 0 rgba(0,0,0,0.3) ,
          -5px -9px 0 0 #bf225b ,
          5px -9px 0 0 #b22554;
   animation: none;
}

.friendball:after {
   box-shadow:
          -4px -8px 4px -1px rgba(255,255,255,0.6) , 
          inset 0px 2px 0 rgba(0,0,0,0.3) ,
          -5px -5px 0 -2px #e5e52d ,
          0 -7px 0 -1px #e5e52d ,
          5px -5px 0 -2px #e5e52d; 
   animation: none;
}
      
.loveball:after {
  box-shadow:
          -4px -8px 4px -1px rgba(255,255,255,0.6) , 
          inset 0px 2px 0 rgba(0,0,0,0.3) ,
          -2px -7px 0 -1px #e22dd6 ,
          0 -5px 0 -1px #e22dd6 ,
          2px -7px 0 -1px #e22dd6;
   animation: none;    
}
      
.ultraball:after {
   box-shadow:
          -4px -8px 4px -1px rgba(255,255,255,0.6) , 
          inset 0px 2px 0 rgba(0,0,0,0.3) ,
          -5px -10px 0 0 rgba(255, 204, 0, 0.6) ,
          5px -10px 0 0 rgba(255, 204, 0, 0.6);
   animation: none;
}
      

      
// how far do we want to roll/move the balls
// figures much higher or smaller than this
// doesn't look "right".

$roll: 18deg; $move: 6px; 
      
// this wobbles and bounces the ball
// like the "capture" animation on the
// gameboy games.
      
@keyframes pokewobble {
  
  2% { transform: rotate(-$roll); margin-left: -$move; }
  4% { transform: rotate($roll); margin-left: $move; }
  6%, 30% { transform: rotate(0deg); margin-left: 0px; }

  32% { transform: rotate(-$roll); margin-left: -$move; }
  34% { transform: rotate($roll); margin-left: $move; }
  36% { transform: rotate(0deg); margin-left: 0px; } 
          
  62% { margin-top: 0; }
  63% { margin-top: -3px; }
  64% { margin-top: 0px; }
  65% { margin-top: -2px; }
  68% { margin-top: 0; }
          
}

// this animates the shadow.
// it's essentially a "inverse"
// of the pokewobble anim.
// psuedo-elements are stuck on the
// parent's plane, so the shadow
// would normally roll around with
// the ball, so we counter it with
// this animation.            

@keyframes pokeshadow {
  2% { transform: rotate($roll); } 
  4% { transform: rotate(-$roll); } 
  6%, 30% { transform: rotate(0deg); }

  32% { transform: rotate($roll); }
  34% { transform: rotate(-$roll);  }
  36% { transform: rotate(0deg); }

  62% { bottom: -2px; }
  63% { bottom: -6px; }
  64% { bottom: -2px; }
  65% { bottom: -4px; }
  68% { bottom: -2px; }
}

// this makes the little button
// "glow" when the pokemon is "caught"
                  
@keyframes pokeglow {

  60% { background: white; box-shadow: $buttonShadow }
  68% { background: rgb(255,95,50); box-shadow: $buttonShadow, 0 0 4px 2px rgb(255,95,50); }
  80% { background: white; box-shadow: $buttonShadow; }
              
}
                  
                  

                  
// general styles for making the entire Pen
// kind pretty. Not needed for the actual mixin.                  

body {
    
    background: #eee;
    background: linear-gradient(to bottom, #fff 0%,#eee 30%,#ddd 30%,#ffffff 70%) no-repeat;
    text-align: center; 
    padding: 150px 50px 50px; min-height: 230px;
    
    ul { list-style: none; margin: 0 auto; padding: 0; width: 200px;
      li {
        display: inline-block; width: 60px; height: 20px;
        &.block { display: block; width: 200px; }
      }
      
      .loveball, .masterball,
      .ultraball, .friendball,
      .greatball { 
         opacity: 0.2;
         transition: 0.3s ease;
      }
          
      &:hover {
        .loveball, .masterball,
        .ultraball, .friendball,
        .greatball { 
           opacity: 1;
        }
      }
    }
    
    .logo {
    
      background: url(http://fc01.deviantart.net/fs71/f/2011/227/6/7/pokemon_logos_by_blackdragonredroses-d46q2qu.png);
      width: 500px; height: 127px; top: 0; background-size: cover;
      position: absolute; left: 50%; margin-left: -250px;
      opacity: 0.1; 
          
    }
}


      



            
          
!
            
              // YOU TEACH ME...
// AND I'll TEACH YOU...
            
          
!
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