JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
<!-- This is in html rather than slim because of thumbnails -->
<div class="head">
<div class="facialhair">
<div class="brow left">
<div class="shadow"></div>
<div class="hair1"></div>
<div class="hair2"></div>
<div class="hair3"></div>
</div>
<div class="brow right">
<div class="shadow"></div>
<div class="hair1"></div>
<div class="hair2"></div>
<div class="hair3"></div>
</div>
</div>
<div class="ear left"></div>
<div class="ear right"></div>
<div class="face">
<div class="eye right milky">
<div class="slash"></div>
<div class="base"></div>
<div class="shadow"></div>
<div class="crowsfoot"></div>
<div class="eyeball">
<div class="pupil"></div>
</div>
</div>
<div class="eye left">
<div class="tired"></div>
<div class="base"></div>
<div class="shadow"></div>
<div class="crowsfoot"></div>
<div class="eyeball">
<div class="pupil"></div>
</div>
</div>
</div>
<div class="nose">
<div class="border"></div>
<div class="bridge">
<div class="dip"></div>
</div>
<div class="slash"></div>
</div>
<div class="hair">
<div class="light"></div>
<div class="widowspeak">
<div class="round"></div>
</div>
<div class="slash"></div>
</div>
<div class="facialhair">
<div class="mustache left"></div>
<div class="mustache right"></div>
<div class="goatee">
<div class="main"></div>
<div class="side left"></div>
<div class="side right"></div>
<div class="further left"></div>
<div class="further right"></div>
</div>
</div>
</div>
// Static
$hair: hsl(0, 77, 63);
$facerand: .5; /* 08 */
// Random
$coinflip: if(random(100) > 20, 1, 0);
$hairsat: if($coinflip == 1, random(10) + 65, random(10));
$hairlum: if($coinflip == 1, 63 - random(10), 50 - random(10));
$hair: hsl(random(45), $hairsat, $hairlum);
$facerand: random(100) / 100;
// Start calculating the rest from the given values above!
$border: #3b0c25;
$hairdark: hsl(hue($hair) - 9, saturation($hair) - 20, lightness($hair) * .65);
$hairlight: hsl(hue($hair) + 20, saturation($hair) + 4, lightness($hair) * 1.3);
$facerandfactor: 30;
$face: hsl(27 + ($facerand * 5), 100 - ($facerandfactor * $facerand), 80 - (($facerandfactor/3) * $facerand));
$facedark: desaturate(darken($face, 30%), 30%);
$blush: hsl(hue($face) - 10, saturation($face) * .75, lightness($face) * (1 - (.1 * $facerand)));
$blushdark: hsl(hue($blush) - 10, saturation($blush) * .62, lightness($blush) * .72);
$fiveoclock: mix($face, hsl(hue($hair) - 5, saturation($hair) * .2, 59%), 40%);
$fiveohighlight: hsl(hue($fiveoclock) + 7, saturation($fiveoclock) + 10, 78%);
$eye: hsl(150 + random(120), 10 + random(40), 50%);
body {
font-size: 9.9vh;
transform-style: preserve-3d;
height: 100vh;
width: 100vw;
margin-left: -7vh;
}
.head {
left: 50%;
top: 50%;
transform: translateX(.7em);
&,
*,
*::before,
*::after {
display: inline-block;
box-sizing: border-box;
position: absolute;
animation-fill-mode: forwards;
}
}
.ear {
z-index: -1;
left: 50%;
top: -.5em;
border-top-right-radius: .25em .6em;
border-bottom-right-radius: .3em .6em;
height: 1.5em;
width: .7em;
background: $face;
transform: rotate(9deg);
border: .12em solid $border;
margin-left: 2.29em;
box-shadow: inset -.04em .08em #fff,
inset -.07em -.2em $face;
&::after {
content: "";
height: .1em;
width: .6em;
background: $border;
transform: rotate(-45deg);
border-top-right-radius: .5em .1em;
top: .35em;
left: -.2em;
}
&::before {
content: "";
background: $face;
border-radius: 100%;
left: -.2em;
top: .36em;
width: .45em;
height: .65em;
box-shadow: inset .31em 0 $facedark,
inset -.03em 0 $facedark;
border-right: .05em solid $border;
transform: rotate(-15deg);
}
&.left {
margin-left: -2.97em;
transform: scaleX(-1) rotate(9deg);
}
}
.hair {
border-top-left-radius: 5em 3em;
border-top-right-radius: 5em 3em;
width: 5em;
margin-top: -3.05em;
height: 6em;
margin-left: -2.5em;
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0.0002, 0, 0, 1, 0, 0, 0, 0, 1) scale(.95);
overflow: hidden;
.light {
left: -.02em;
right: -.02em;
border-top-left-radius: 5em 3em;
border-top-right-radius: 5em 3em;
height: 3.1em;
border: .2em solid $fiveohighlight;
border-bottom: none;
margin-top: -.1em;
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, -0.0002, 0, 0, 1, 0, 0, 0, 0, 1);
&::before {
content: "";
border-top-left-radius: 5em 3em;
border-top-right-radius: 5em 3em;
height: 2.85em;
border: .1em solid $fiveoclock;
border-top-width: .3em;
border-bottom: none;
width: 102%;
margin-left: -1%;
margin-top: 0.05em;
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, -0.00001, 0, 0, 1, 0, 0, 0, 0, 1);
}
}
.widowspeak {
background: $fiveoclock;
left: 0;
right: 0;
height: 1.8em;
z-index: -1;
&::after,
&::before {
content: "";
border-top: 0.5em solid $face;
background: $face;
left: .23em;
top: .9em;
height: 1em;
width: 2.3em;
border-top-left-radius: 4em;
border-top-right-radius: 4.7em 2.5em;
}
&::after {
left: initial;
right: .22em;
transform: scaleX(-1);
}
.round {
right: 0;
left: 0;
&::before {
content: "";
z-index: 2;
right: 0;
left: 50%;
width: 30%;
transform: translate(-50%,0) scaleX(1.3);
height: 1.13em;
top: 0.02em;
background: $fiveoclock;
border-bottom-left-radius: 50% 100%;
border-bottom-right-radius: 50% 100%;
}
&::after {
content: "";
background: $face;
width: .8em;
height: .5em;
top: 1em;
left: 50%;
margin-left: -.4em;
}
}
}
.slash {
border-top: .1em solid transparent;
border-bottom: .1em solid transparent;
border-right: 1.3em solid $face;
top: .7em;
left: 2.5em;
transform: rotate(30deg);
}
}
.face {
background: $face;
margin-left: -2.5em;
width: 5em;
margin-top: -3em;
height: 5.6em;
border: .12em solid $border;
border-top-left-radius: 5em 3em;
border-top-right-radius: 5em 3em;
border-bottom-left-radius: 5em 3.5em;
border-bottom-right-radius: 5em 3.5em;
overflow: hidden;
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0.0002, 0, 0, 1, 0, 0, 0, 0, 1);
&::before,
&::after {
width: 1.3em;
height: 2.3em;
content: "";
background: $blush;
bottom: 0;
}
&::before {
border-top-right-radius: 1.3em 2.3em;
}
&::after {
border-top-left-radius: 1.3em 2.3em;
right: 0;
}
}
.eye {
height: 1em;
width: 1em;
top: 40%;
right: 20%;
font-size: .9em;
z-index: 4;
&.left {
transform: scaleX(-1);
right: inherit;
left: 20%;
.eyeball {
transform: scaleX(-1);
animation: blink 5s infinite;
}
}
&.right {
.eyeball {
z-index: 2;
}
}
@if (random(5) > 1) {
&.milky {
.pupil {
opacity: .5;
}
}
.slash {
height: 0;
width: 0;
z-index: 1;
top: .35em;
left: .65em;
border-radius: 0;
border: .08em solid $border;
border-width: 1em 0.1em 0 0.1em;
border-color: $border transparent transparent transparent;
background: transparent;
transform: rotate(-30deg);
&::before {
content: "";
bottom: 0;
right: .05em;
height: 1em;
width: .02em;
background: #fff;
transform: rotate(-7deg);
}
&::after {
content: "";
background: $border;
width: .15em;
height: .02em;
left: -.075em;
top: -.2em;
border-radius: 100%;
}
}
}
.tired {
height: .9em;
width: .7em;
background: $border;
border-radius: 100%;
transform: rotate(-45deg);
top: .09em;
left: .28em;
}
.base {
transform: rotate(-65deg) scaleY(1.2);
width: 1em;
height: 1em;
&::before,
&::after {
content: "";
border-radius: 100%;
background: $facedark;
font-size: .6em;
width: 1em;
height: 1em;
left: -17%;
top: 20%;
margin-left: 5%;
}
&::after {
background: $face;
left: -8%;
height: 1.3em;
width: .5em;
margin-top: -10%;
}
}
.shadow {
border-radius: 100%;
background: $facedark;
width: 1em;
height: 1em;
border: .1em solid $facedark;
border-width: .05em 0 0 .1em;
transform: rotate(-45deg);
}
.crowsfoot {
left: .15em;
top: .15em;
transform: rotate(-20deg);
border-radius: 100%;
width: .8em;
height: .8em;
border: .1em solid #3b0c24;
border-width: 0 0 0 .1em;
&::before {
content:"";
bottom: .03em;
left: -.2em;
background: $facedark;
width: .18em;
height: .18em;
border-radius: 100%;
}
}
.eyeball {
border: .1em solid #3b0c24;
border-radius: 100%;
width: .7em;
height: .7em;
left: .15em;
top: .15em;
overflow: hidden;
background: #fff;
&::before,
&::after {
border-radius: 100%;
width: .5em;
height: .5em;
background: #bfb5bf;
content: "";
position: absolute;
left: 0;
top: 0;
}
&::after {
top: .2em;
left: .05em;
background: #fff;
}
}
.pupil {
background: $border;
background-image: radial-gradient(farthest-corner at .05em .05em, mix($border, $eye, 50%) 50%, $eye 100%);
border-radius: 100%;
width: .3em;
height: .3em;
left: .1em;
top: .1em;
z-index: 1;
overflow: hidden;
border: .06em solid mix($border, $eye, 60%);
&::before,
&::after {
content: "";
background: #fff;
border-radius: 100%;
}
&::before {
top: -.07em;
left: -.07em;
width: .2em;
height: .2em;
}
&::after {
bottom: -.03em;
right: -.03em;
width: .1em;
height: .1em;
}
}
}
.nose {
background: #fff;
width: 1.2em;
height: 2.1em;
border-top-right-radius: 5em 2em;
border-top-left-radius: 5em 2em;
border-bottom-right-radius: 5em 2.5em;
border-bottom-left-radius: 5em 2.5em;
top: -1.3em;
left: 50%;
margin-left: -.59em;
z-index: 8;
overflow: hidden;
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, -0.002, 0, 0, 1, 0, 0, 0, 0, 1);
&::after {
content: "";
bottom: 0;
height: .3em;
background: $blushdark;
left: 0;
right: 0;
}
.border {
top: 0;
left: 0;
bottom: 0;
right: 0;
border: .1em solid $border;
border-top: none;
border-bottom-right-radius: 5em 2.5em;
border-bottom-left-radius: 5em 2.5em;
z-index: 10;
}
.bridge {
&::before {
content: "";
background: $blush;
top: -.08em;
left: .12em;
height: .9em;
width: 1.2em;
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0.005, 0, 0, 1, 0, 0, 0, 0, 1) rotate(5deg);
}
&::after {
content: "";
top: 1.2em;
left: 0;
height: .7em;
width: 1.2em;
background: #fff;
border-top-right-radius: 5em .5em;
border-top-left-radius: 5em .5em;
border-bottom-right-radius: 5em 1em;
border-bottom-left-radius: 5em 1em;
z-index: 1;
}
.dip {
left: 0;
background: $blushdark;
top: 0.78em;
height: 0.46em;
width: 1.4em;
&::after {
content: "";
top: .3em;
left: 0;
height: .84em;
width: 1.3em;
background: $blush;
border-top-right-radius: 5em .5em;
border-top-left-radius: 5em .5em;
border-bottom-right-radius: 5em 1em;
border-bottom-left-radius: 5em 1em;
z-index: 2;
transform: matrix3d(0.84, 0, 0, -0.0003, 0.12, 0.88, 0, 0.0002, 0, 0, 1, 0, 0, 0, 0, 1);
}
}
}
.slash {
border-style: solid;
border-color: transparent #3b0c26 transparent transparent;
border-width: 0.1em 1em 0.05em 0;
top: 0.8em;
transform: rotate(-15deg);
right: 0;
z-index: 3;
&::after {
content: "";
border-style: solid;
border-color: $blush transparent transparent transparent;
border-width: 0.08em 0.3em 0em 0.6em;
top: 0.02em;
left: 0;
transform: rotate(2deg);
}
}
}
.facialhair {
z-index: 6;
.brow {
top: -1.7em;
transform: scale(1.3);
z-index: 2;
.shadow {
&,
&::before,
&::after {
width: .3em;
height: .03em;
border-radius: 0;
border-top-right-radius: .3em .03em;
background: $border;
}
left: .3em;
top: .35em;
transform: rotate(-75deg);
&::before {
content: "";
left: .1em;
top: .55em;
transform: rotate(60deg);
}
&::after {
content: "";
left: -.37em;
top: .8em;
transform: rotate(80deg);
}
}
&.left {
animation: blinkeyebrow 5s infinite;
transform: scale(1.3) scaleX(-1);
}
.hair1,
.hair2,
.hair3 {
width: 1em;
height: .45em;
border-top-left-radius: .5em .4em;
border-top-right-radius: .5em .4em;
background: $hairdark;
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, -0.005, 0, 0, 1, 0, 0, 0, 0, 1) scaleY(.8) rotate(-7deg);
top: .53em;
left: .35em;
border: .08em solid $border;
&::after {
content: "";
background: $hair;
border-top-left-radius: .4em .25em;
border-top-right-radius: .5em .25em;
width: .9em;
height: .25em;
top: -.16em;
left: -.03em;
transform: rotate(-4deg);
}
}
.hair2 {
background: $hair;
margin-top: -.16em;
border-right-color: $hairlight;
border-right-width: .18em;
transform: matrix3d(1, 0, 0, 0, 0, 1, 0, -0.005, 0, 0, 1, 0, 0, 0, 0, 1) rotate(-9deg) scaleY(.8) scaleX(-1);
overflow: hidden;
box-shadow: inset 0 .04em 0 $hairdark;
}
.hair1 {
background: $hair;
margin-top: -.28em;
transform: scale(.8) rotate(-38deg);
border-bottom-width: .05em;
left: .13em;
box-shadow: inset 0 .1em 0 $hairlight;
&::after { display: none; }
}
.hair3 {
&::before {
content: "";
height: .1em;
width: .5em;
background: $border;
top: 0.05em;
left: -0.1em;
z-index: 2;
border-radius: 0;
border-top-right-radius: .5em .1em;
transform: rotate(-15deg);
}
}
}
.mustache {
position: absolute;
left: 50%;
top: 50%;
transform: rotate(-25deg) translate(-.45em,.45em);
position: absolute;
z-index: 3;
animation: mustacheblinkalt 5s infinite;
&.left {
transform: scaleX(-1) rotate(-25deg) translate(-.45em,.45em);
animation: mustacheblink 5s infinite;
}
&::before,
&::after {
content: "";
border-top-right-radius: 100% 100%;
border-bottom-left-radius: 100% 70%;
width: 1.3em;
height: 1.6em;
background: $hair;
border: .08em solid $border;
z-index: -1;
box-shadow: inset .2em 0.005em $hairdark,
inset .28em .1em $border,
inset -0.18em -0.13em $hairlight;
position: absolute;
}
&::after {
border-color: transparent;
background: transparent;
box-shadow: inset -0.2em -0.1em $hairlight;
transform: rotate(8deg) translate(.15em,.32em) scale(.7,.4);
}
}
.goatee {
background: $hair;
width: 3em;
height: 1.8em;
transform: translate(-50%,.8em);
border-top-right-radius: 50% 40%;
border-top-left-radius: 50% 40%;
border-bottom-left-radius: 50% 40%;
border-bottom-right-radius: 50% 40%;
&::after,
&::before {
content: "";
width: .5em;
height: .3em;
left: 50%;
top: .65em;
transform: translate(-50%,0);
border-top: .1em solid $hairdark;
border-radius: 100%;
}
&::before {
border-top: .07em solid lighten($hairlight, 15%);
top: .5em;
width: .3em;
height: .2em;
}
.main {
left: 50%;
z-index: 2;
&::before,
&::after {
content: "";
background: $hair;
width: 1.5em;
height: 1.5em;
border-top-right-radius: 100% 100%;
border-bottom-left-radius: 100% 100%;
margin-left: -.75em;
top: .85em;
z-index: -2;
transform: scaleY(.8) rotate(45deg);
box-shadow: inset -.15em -.15em $border;
}
&::after {
box-shadow: inset -.25em -.25em $hairdark;
transform: scale(.85,.7) rotate(45deg);
border-top-right-radius: 100% 100%;
border-bottom-left-radius: 100% 100%;
top: .75em;
}
}
.side {
left: 50%;
z-index: -4;
&.left {
transform: scaleX(-1);
}
&::before,
&::after {
content: "";
background: $hair;
width: .85em;
height: .4em;
border-bottom-right-radius: 100% 100%;
top: 1.55em;
z-index: -4;
margin-left: .3em;
transform: rotate(-40deg);
box-shadow: inset .1em -.13em $border,
inset .21em -.26em $hairdark;
}
&::after {
margin-left: .78em;
top: 1.33em;
z-index: -5;
box-shadow: inset .1em -.13em $border,
inset .21em 0 $hairdark,
inset 0 -.3em $hair;
transform: rotate(-30deg);
background: transparent;
}
}
.further {
left: 50%;
z-index: -3;
&.left {
transform: scaleX(-1);
z-index: -1;
}
&::before {
content: "";
background: $hair;
width: .6em;
height: .6em;
border-top-right-radius: 100% 100%;
border-bottom-left-radius: 100% 100%;
transform: rotate(37deg);
top: .85em;
z-index: 0;
margin-left: 1.2em;
box-shadow: inset -.08em -.06em $border,
inset -0.03em -0.1em $hairdark;
}
// &::after {
// margin-left: .75em;
// top: 1.25em;
// z-index: -5;
// box-shadow: inset .1em -.13em $border,
// inset .21em 0 $hairdark;
// }
}
}
}
@keyframes blink {
10% { transform: scaleX(-1) scaleY(1); margin-top: 0;}
12.5% { transform: scaleX(-1) scaleY(0); margin-top: .1em; }
15% { transform: scaleX(-1) scaleY(1); margin-top: 0; }
50% { transform: scaleX(-1) scaleY(1); margin-top: 0;}
54% { transform: scaleX(-1) scaleY(0); margin-top: .1em; }
58% { transform: scaleX(-1) scaleY(1); margin-top: 0; }
60% { transform: scaleX(-1) scaleY(1); margin-top: 0;}
62% { transform: scaleX(-1) scaleY(0); margin-top: .1em; }
64% { transform: scaleX(-1) scaleY(1); margin-top: 0; }
}
@keyframes blinkeyebrow {
10% { transform: scale(1.3) scaleX(-1) rotate(0deg); }
12.5% { transform: scale(1.3) scaleX(-1) rotate(2deg); }
15% { transform: scale(1.3) scaleX(-1) rotate(0deg); }
50% { transform: scale(1.3) scaleX(-1) rotate(0deg);}
54% { transform: scale(1.3) scaleX(-1) rotate(2deg); }
58% { transform: scale(1.3) scaleX(-1) rotate(0deg); }
60% { transform: scale(1.3) scaleX(-1) rotate(0deg); }
62% { transform: scale(1.3) scaleX(-1) rotate(2deg); }
64% { transform: scale(1.3) scaleX(-1) rotate(0deg); }
}
@keyframes mustacheblink {
10% { transform: scaleX(-1) rotate(-25deg) translate(-.45em,.45em) }
12.5% { transform: scaleX(-1) rotate(-26deg) translate(-.45em,.45em) }
15% { transform: scaleX(-1) rotate(-25deg) translate(-.45em,.45em) }
50% { transform: scaleX(-1) rotate(-25deg) translate(-.45em,.45em)}
54% { transform: scaleX(-1) rotate(-26deg) translate(-.45em,.45em) }
58% { transform: scaleX(-1) rotate(-25deg) translate(-.45em,.45em) }
60% { transform: scaleX(-1) rotate(-25deg) translate(-.45em,.45em) }
62% { transform: scaleX(-1) rotate(-26deg) translate(-.45em,.45em) }
64% { transform: scaleX(-1) rotate(-25deg) translate(-.45em,.45em) }
}
@keyframes mustacheblinkalt {
80% { transform: rotate(-25deg) translate(-.45em,.45em) }
82% { transform: rotate(-26deg) translate(-.45em,.45em) }
84% { transform: rotate(-25deg) translate(-.45em,.45em) }
}
/* I need to finish this sometime */
Also see: Tab Triggers