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="charmander polygon-wrap">
  <div class="tail stem"></div>
  <div class="tail end"></div>
  
  <div class="flame yellow"></div>
  <div class="flame red"></div>
  
  <div class="body left"></div>
  <div class="body right"></div>
  <div class="belly right"></div>
  <div class="belly left"></div>
  <div class="arm left"></div>
  <div class="arm right"></div>
  <div class="leg left"></div>
  <div class="leg right"></div>
  <div class="foot left"></div>
  <div class="foot right"></div>
  
  
  <div class="mouth"></div>
  <div class="tongue"></div>

  <div class="head left"></div>
  <div class="head right"></div>
  <div class="eye left"></div>
  <div class="eye right"></div>
  <div class="pupil right"></div>
  <div class="pupil left"></div>
  <div class="nostril left"></div>
  <div class="nostril right"></div>


</div>
              
            
!

CSS

              
                $top: 12%;
$clr-orange: #ffac3d;
$clr-orange2: #f3973e;
html,css {
  margin: 0;
}
.charmander {
  position: absolute;
  left: 50%;
  transform: translateX(-50%)  translateY(-50%);
  top: 50%;
  width: 378px;
  height: 518px;
  /* background-color: rgba(19, 156, 216, .5); */
  cursor: pointer;
}
.charmander * {
  position: absolute;
  width: 100%;
  height: 100%;
  transition: .18s cubic-bezier(.7,.3,0,1); 
}
.nostril {
  background-color: #5f617a;
}
.nostril.left {
  -webkit-clip-path: polygon( 
    46% $top + 30% ,
    48% $top + 30% ,
    48% $top + 32% );
}
.charmander:hover .nostril.left {
  -webkit-clip-path: polygon( 
    49% $top + 29% ,
    49% $top + 30% ,
    47% $top + 29% );
}
.charmander:hover .nostril.right {
  -webkit-clip-path: polygon( 
    51% $top + 29% ,
    51% $top + 30% ,
    53% $top + 29% );

}
.nostril.right {
  -webkit-clip-path: polygon( 
    54% $top + 30% ,
    52% $top + 30% ,
    52% $top + 32% );
}
.eye {
  background-color: #5f617a;
}
.eye.left {
  -webkit-clip-path: polygon(
    48% $top + 15%, 
    39% $top + 24%, 
    48% $top + 24%);
}
.eye.right {
  -webkit-clip-path: polygon(
    52% $top + 15%, 
    61% $top + 24%, 
    52% $top + 24%);
}
.charmander:hover .eye.left {
  -webkit-clip-path: polygon(
    48% $top + 20%, 
    40% $top + 24%, 
    48% $top + 24%);
}
.charmander:hover .eye.right {
  -webkit-clip-path: polygon(
    52% $top + 20%, 
    60% $top + 24%, 
    52% $top + 24%);
}

.pupil {
 background-color: white;
}
.pupil.right {
  -webkit-clip-path: polygon(
    53% $top + 18%, 
    55% $top + 20%, 
    53% $top + 20%);
}
.pupil.left {
  -webkit-clip-path: polygon(
    47% $top + 18%, 
    45% $top + 20%, 
    47% $top + 20%);
}
.charmander:hover .pupil.left {
  background-color: #5f617a;
  -webkit-clip-path: polygon(
    47% $top + 22%, 
    43% $top + 23%, 
    46% $top + 23%);
}
.charmander:hover .pupil.right {
  background-color: #5f617a;

  -webkit-clip-path: polygon(
    53% $top + 22%, 
    57% $top + 23%, 
    54% $top + 23%);
}

.arm.left {
  background-color: $clr-orange2;
  -webkit-clip-path: polygon(
    44% $top + 32%,
    39% $top + 42%, 
    48% $top + 48%);
}
.charmander:hover .arm.left {
  -webkit-clip-path: polygon(
    44% $top + 32%,
    41% $top + 38%, 
    22% $top + 28%);
}
.arm.right {
  background-color: $clr-orange;
  -webkit-clip-path: polygon(
    56% $top + 32%,
    61% $top + 42%, 
    52% $top + 48%);
}
.charmander:hover .arm.right {
  -webkit-clip-path: polygon(
    56% $top + 32%,
    59% $top + 38%, 
    78% $top + 28%);
}
.body.left {
  -webkit-clip-path: polygon(
    50% $top + 18%,
    35% $top + 50%, 
    50% $top + 60%);
  background-color: $clr-orange;
}
.body.right {
  -webkit-clip-path: polygon(
    50% $top + 18%,
    65% $top + 50%, 
    50% $top + 60%);
  background-color: $clr-orange2;
}
.belly.right {
  -webkit-clip-path: polygon(
    50% $top + 30%,
    62% $top + 54%, 
    50% $top + 60%);
  background-color: #f7e3c9;
}
.belly.left {
  -webkit-clip-path: polygon(
    50% $top + 30%,
    38% $top + 54%, 
    50% $top + 60%);
  background-color: #f7e3c9;
}

.tail.stem {
  background-color: $clr-orange;
  -webkit-clip-path: polygon( 
    65% $top + 50% ,
    61% $top + 59% ,
    80% $top + 50% );
}
.tail.end {
 background-color: $clr-orange2;

-webkit-clip-path: polygon( 
  72% $top + 50% ,
  80% $top + 50% ,
  70% $top + 38% );
}

.charmander:hover .flame.red {
  -webkit-animation: flame .12s infinite;
}
.charmander:hover .flame.yellow {
  -webkit-animation: flame2 .15s infinite;
}
.flame.yellow {
  background-color: #f2d11c ;
  -webkit-animation: flame2 .32s infinite;
}
@-webkit-keyframes flame {
  0% {
    -webkit-clip-path: polygon( 
      64.630% $top + 34.189% ,
      69.444% $top + 33.649% ,
      71.667% $top + 41.216% );
  }
  100% {
    -webkit-clip-path: polygon( 
      67.593% $top + 42.027% ,
      75.741% $top + 41.486% ,
      65.370% $top + 31.757% );
  }
}
@-webkit-keyframes flame2 {
  0%   { 
  -webkit-clip-path: polygon( 
    73.889% $top + 35.541% ,
    67.963% $top + 40.946% ,
    76.852% $top + 40.135% );
  }
  100% { 
  -webkit-clip-path: polygon( 
    68.704% $top + 31.757% ,
    77.963% $top + 31.486% ,
    71.296% $top + 40.676% );
  }
}
.flame.red {
  background-color: #f21c1c;
  -webkit-animation: flame .35s infinite;
}

.foot.left {
  background-color: $clr-orange2;
  -webkit-clip-path: polygon( 
    40% $top + 60% , 
    46% $top + 65% ,
    34% $top + 65% );
}
.foot.right {
  background-color: $clr-orange;
  -webkit-clip-path: polygon( 
    60% $top + 60% , 
    66% $top + 65% ,
    54% $top + 65% );
}
.leg.left {
  background-color: $clr-orange;
  -webkit-clip-path: polygon(
    35% $top + 50% ,
    40% $top + 65% ,
    50% $top + 60% );
}
.leg.right {
  background-color: $clr-orange2;
  -webkit-clip-path: polygon(
    65% $top + 50% ,
    60% $top + 65% ,
    50% $top + 60% );
}

.mouth {
  -webkit-clip-path: polygon(
    32% $top + 25%, 
    50% $top + 38%, 
    68% $top + 25%);
  background-color: #e18100;
}
.tongue {
  -webkit-clip-path: polygon(
    40% $top + 28%, 
    50% $top + 35%, 
    60% $top + 28%);
  background-color: #ff9287;
}
.head.left {
  -webkit-clip-path: polygon(
    50% $top + 10%, 
    32% $top + 25%, 
    50% $top + 35%);
  background-color: $clr-orange;
}
.charmander:hover .head.left {
  -webkit-clip-path: polygon(
    50% $top + 10%, 
    32% $top + 25%, 
    50% $top + 32%);
}

.head.right {
  -webkit-clip-path: polygon(
    50% $top + 10%, 
    68% $top + 25%, 
    50% $top + 35%);
  background-color: $clr-orange2;
}
.charmander:hover .head.right {
  -webkit-clip-path: polygon(
    50% $top + 10%, 
    68% $top + 25%, 
    50% $top + 32%);
}


              
            
!

JS

              
                var nodecount = 0;
var nodescss = '-webkit-clip-path: polygon( ';
$('body').on('click', function(e) {
  
  
  var mouseX = e.pageX;
  var mouseY = e.pageY;

  var shapesoffsetX = $('.polygon-wrap').offset().left;
  var shapesoffsetY = $('.polygon-wrap').offset().top;

  var polygonswidth = $('.polygon-wrap').width();
  var polygonsheight = $('.polygon-wrap').height();

  var shapesmouseX = mouseX - shapesoffsetX;
  var shapesmouseY = mouseY - shapesoffsetY;

  var mousepercentX = shapesmouseX / polygonswidth;
  var mousepercentY = shapesmouseY / polygonsheight;

  var finalmouseX = (mousepercentX) * 100;
  var finalmouseY = (mousepercentY) * 100;
  var normalisedX = parseFloat(finalmouseX).toFixed(3);
  var normalisedY = parseFloat(finalmouseY).toFixed(3);

  nodecount = nodecount + 1;

  if (nodecount < 3) {
    nodescss = nodescss + normalisedX + '% ' + normalisedY + '% ,';
  } else
  if (nodecount == 3) {
    nodescss = nodescss + normalisedX + '% ' + normalisedY + '% );';
    alert(nodescss);
    nodescss = '-webkit-clip-path: polygon( ';
    nodecount = 0;
  }
});
              
            
!
999px

Console