Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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="container-fluid gradient container-box">
  <section class="row">
    <div class="col-md-4" id="svg-container">
      <svg width="80%" height="80%" viewBox="0 0 287.653 329.331" xml:space="preserve" class="intro">
<path id="Head_base" fill="#FDD4BD" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M278.4,198.941
	c-5.82,3.13-9.98-2.7-11.9-6.35c-9.85,76.75-61.13,135.24-122.92,135.24c-60.52,0-110.463-61.897-121.763-136.317
	c-1.34,5.92-9.47,11.931-14.337,6.667c-6.163-6.667-8.955-56.688-1.497-65c7.854-8.5,14.853,3.083,15.833,4.833 C32.927,63.285,82.88,3.561,143.58,3.561c63.88,0,116.54,62.53,123.78,143.11c0.65-1.97,5.22-14.68,13.42-7.17
	C289.65,147.621,286.61,194.531,278.4,198.941z"/>
        
<!--    Eyebrows      -->
        
        <g id="Sadbrows" class="brows">
		<line id="LeftbrowSad_3_" fill="none" stroke="#000000" stroke-width="4" stroke-miterlimit="10" x1="115.825" y1="149.348" x2="65.474" y2="154.309"/>
		<line id="RightbrowSad_3_" fill="none" stroke="#000000" stroke-width="4" stroke-miterlimit="10" x1="199.503" y1="149.64" x2="247.613" y2="154.017"/>
</g>
        
<g id="Angrybrows" class="brows">
		<line id="LeftbrowAngry_2_" fill="none" stroke="#000000" stroke-width="4" stroke-miterlimit="10" x1="119.069" y1="161.62" x2="65.725" y2="140.747"/>
		<line id="RightbrowAngry_2_" fill="none" stroke="#000000" stroke-width="4" stroke-miterlimit="10" x1="184.564" y1="162.62" x2="237.908" y2="141.747"/>
</g>
        
<g id="Happybrows" class="brows">
	<path id="LeftbrowHappy_2_" fill="none" stroke="#000000" stroke-width="4" stroke-miterlimit="10" d="M115.825,149.348
		c-20.026-1.641-37.242-0.426-50.351,4.96"/>
	<path id="RightbrowHappy_2_" fill="none" stroke="#000000" stroke-width="4" stroke-miterlimit="10" d="M199.503,149.64
		c19.745-3.375,36.866-3.331,48.11,4.377"/>
</g>
        
<!--    Eyes      -->
        
<ellipse id="Right_eye" stroke="#000000" stroke-miterlimit="10" cx="221.15" cy="177.431" rx="10.5" ry="10.874"/>
<ellipse id="Left_eye" stroke="#000000" stroke-miterlimit="10" cx="90.65" cy="178.431" rx="10.5" ry="10.874"/>
        
<!--    Mouths      -->
        
<line id="Baseline" class="mouth" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" x1="125.65" y1="301.181" x2="186.15" y2="284.181"/>
        <path id="Happy" class="mouth" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M137.9,286.931
	c25.408,6.189,35.027,7.924,51.5-9.25"/>
<path id="Sad" fill="none" class="mouth" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M137.9,295.796
	c21.92-15.754,31.505-14.236,51.5-9.25"/>
        
<!--    Noses      -->
        
<path id="Pointed" fill="none" class="nose" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M155.149,180.095
	c7.606,25.957,15.444,50.871,27.001,59.086c-4.475,13.493-16.593,18.028-30.554,20.305"/>
        
<path id="Curved" fill="none" class="nose" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M152.817,181.8l14.532,39.028
	c23.186-0.714,29.773,22.653,8.304,23.251h-17.438"/>       
        
<path id="Angled" fill="none" class="nose" stroke="#000000" stroke-width="3" stroke-miterlimit="10" d="M156.483,189.305
c13.205,16.286,20.831,34.246,20.667,54.543c0,0-23.193-8.333-25.333-4"/>
        
<!--    Hair      -->
        
<polygon id="Plainhair" fill="brown" class="hair" stroke="#000000" stroke-width="3" stroke-miterlimit="10" points="40.973,68.586 
	32.585,99.755 20.723,143.835 69.15,94.705 106.15,138.205 146.65,89.205 187.15,135.205 223.558,89.205 267.36,148.695 
	261.4,104.955 250.65,65.705 232.65,33.205 187.15,7.085 127.223,3.085 78.15,17.705 "/>
<g id="Dihydrotestosterone" class="hair">
	<polygon id="Baldleft_1_" fill="brown" stroke="#000000" stroke-width="3" stroke-miterlimit="10" points="23.15,143.205 
		23.483,102.372 42.15,69.705 65.474,43.266 80.15,29.36 65.474,94.705 36.65,143.205 34.817,146.205 30.15,159.872 	"/>
	<polygon id="Baldright_1_" fill="brown" stroke="#000000" stroke-width="3" stroke-miterlimit="10" points="233.519,51.339 
		258.15,88.705 266.15,125.205 267.817,146.372 262.817,164.372 226.65,99.289 220.4,64.858 214.296,34.205 	"/>
</g>
<polygon id="Bangs" fill="brown" class="hair" stroke="#000000" stroke-width="3" stroke-miterlimit="10" points="139.817,1.539 
	90.65,17.205 51.15,54.539 23.817,94.539 7.817,308.539 49.15,196.329 51.817,136.539 76.483,105.872 90.65,143.205 123.15,101.205 
	143.826,165.205 166.873,90.539 189.4,129.872 214.483,90.539 231.65,134.705 246.149,104.172 250.15,135.205 252.65,200.205 
	267.15,321.872 279.65,200.205 268.65,89.205 247.613,46.539 194.483,10.585 "/>
    </div>
    <div class="col-md-8">
      <h2 id="titletext">Stuff changes when you click on a thing<span style="font-size:5px; margin-left:10px">Amazing vector art Tom, you're hired.</span></h2>
      <div class="row">
      <div class="col-md-6">
        <div class="form-group">
          <label>Hair Color :</label>
          <select class="form-control" id="haircol-controller">
    <option value="brownfill">Brown</option>
    <option value="redfill">Red</option>
    <option value="greyfill">Grey</option>
    <option value="greenfill">Green</option>
    <option value="bluefill">Blue</option>
    <option value="whitefill">White</option>
    <option value="blackfill">Black</option>
  </select>
        </div>
        <div class="form-group">
          <label>Eye Color :</label>
          <select class="form-control" id="eye-controller">
    <option value="blackfill">Black</option>
    <option value="brownfill">Brown</option>
    <option value="redfill">Red</option>
    <option value="greyfill">Grey</option>
    <option value="greenfill">Green</option>
    <option value="bluefill">Blue</option>
    <option value="whitefill">White</option>

  </select>
        </div>
        <div class="form-group">
          <label>Nose Type :</label>
          <select class="form-control" id="nose-controller">
    <option value="Pointed">Pointed</option>
    <option value="Angled">Angled</option>
    <option value="Curved">Curved</option>
  </select>
        </div>

        <div class="form-group">
          <label>Mouth Type :</label>
          <select class="form-control" id="mouth-controller">
    <option value="Baseline">Baseline</option>
    <option value="Happy">Happy</option>
    <option value="Sad">Sad</option>
  </select>
        </div>
        
                <div class="form-group">
          <label>Brow Type :</label>
          <select class="form-control" id="brow-controller">
    <option value="Happybrows">Happy</option>
    <option value="Sadbrows">Sad</option>
    <option value="Angrybrows">Angry</option>
  </select>
        </div>
      </div>
      <div class="col-md-6">
                       <div class="form-group">
          <label>Hair Style :</label>
          <select class="form-control" id="hairsty-controller">
    <option value="Plainhair">Plain</option>
    <option value="Dihydrotestosterone">Dihydrotestosterone</option>
    <option value="Bangs">Bangs</option>
  </select>
              
            
!

CSS

              
                /* Background gradient */
.gradient {
  background: grey;
  background: -webkit-linear-gradient(white, grey);
  background: -o-linear-gradient(white, #dddddd);
  background: -moz-linear-gradient(white, #dddddd);
  background: linear-gradient(white, #dddddd);
}
/* Colors */
.bluefill {
  fill: blue;
}
.redfill {
  fill: red;
}
.greenfill {
  fill: green;
}
.greyfill {
  fill: grey;
}
.brownfill {
  fill: brown;
}

.whitefill {
  fill: white;
}

.blackfill {
  fill: black;
}

button {
  margin-top: 3em;
}
.container-box {
  margin-top: 30px;
}
/* Intro animation */
.intro {
  stroke-miterlimit: 10;
  stroke-dasharray: 6900;
  stroke-dashoffset: 4;
  animation: intro-dash 6s linear forwards;
}

@keyframes intro-dash {
  from {
    stroke-dashoffset: 8500;
    opacity: 0.5;
  }
  to {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

/* Eye movement */

@keyframes eyeMove {
  0% {
    transform: translate(-10px, -10px);
  }
  50% {
    transform: translate(10px, 0px);
  }
  100% {
    transform: translate(0px, -5px);
  }
}

#Right_eye,
#Left_eye {
  animation-duration: 10s;
  animation-name: eyeMove;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

/*  Head movement  */

@keyframes headMove {
  0% {
    transform: rotateX(10deg);
  }
  100% {
    transform: rotateX(-10deg);
  }
}

#svg-container {
  animation-duration: 3s;
  animation-name: headMove;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

svg {
  display: block;
  margin: auto;
}

@keyframes textglow {
  0% {
    color: black;
  }
  50% {
    color: grey;
  }
  100% {
    color: blue;
  }
}

#titletext {
  animation-name: textglow;
  animation-duration: 3s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

@keyframes headmove {
  0% {
  }
  100% {scale3d(30px,-10px,100px)
  }
}

.headmove {
  animation-name: headmove;
  animation-duration: 3s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

              
            
!

JS

              
                // Hair color controller

$("#haircol-controller").change(function() {
  $(".hair, .hair > polygon")
    .removeClass(function(index, className) {
      return (className.match(/(^|\s)\S+fill/g) || []).join(" ");
    })
    .addClass($(this).val());
});

// Eye controller

$("#eye-controller").change(function() {
  $("#Left_eye, #Right_eye")
    .removeAttr("class")
    .addClass($(this).val());
});

// Nose controller

$("#Curved").hide();
$("#Angled").hide();
$("#nose-controller").change(function() {
  $(".nose").hide();
  $("#" + $(this).val()).show();
});

// Mouth Controller

$("#Happy").hide();
$("#Sad").hide();
$("#mouth-controller").change(function() {
  $(".mouth").hide();
  $("#" + $(this).val()).show();
});

// Brow Controller

$("#Angrybrows").hide();
$("#Sadbrows").hide();
$("#brow-controller").change(function() {
  $(".brows").hide();
  $("#" + $(this).val()).show();
});

// Hairstyle controller

$("#Dihydrotestosterone").hide();
$("#Bangs").hide();
$("#hairsty-controller").change(function() {
  $(".hair").hide();
  $("#" + $(this).val()).show();
});

// Toggle eye animation (because the eye color changer works via removing classes, i've had to target via ID and remove CSS attributes)


$('eye-animate-toggle').toggle(function () {
    $("#Right_eye, #Left_eye").css('animation-name', "none");
}, function () {
    $("#Right_eye, #Left_eye").css('animation-name', "eyeMove");
});
              
            
!
999px

Console