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 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

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 id="container">
	<div id="video-container">
		<video id="video" width="400" height="300" preload="auto" loop playsinline autoplay></video>
		<canvas id="overlay" width="400" height="300"></canvas>
	</div>
	<div id="svg-container">
		<div>
			<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300">
				<defs>
					<linearGradient id="grad-a" x1="124.9449" x2="193.5293" y1="71.7645" y2="134.5257" gradientUnits="userSpaceOnUse">
						<stop offset="0" stop-color="#bf9677"/>
						<stop offset=".039915" stop-color="#ab7f5d"/>
						<stop offset=".086125" stop-color="#9b6c47"/>
						<stop offset=".1407" stop-color="#8e5d36"/>
						<stop offset=".2082" stop-color="#85532b"/>
						<stop offset=".3029" stop-color="#7f4d24"/>
						<stop offset=".5658" stop-color="#7e4b22"/>
					</linearGradient>
					<linearGradient id="grad-b" x1="199.4717" x2="200.588" y1="165.5745" y2="242.0395" gradientUnits="userSpaceOnUse">
						<stop offset="0" stop-color="#7e4b22"/>
						<stop offset="1" stop-color="#603416"/>
					</linearGradient>
					<radialGradient id="grad-c" cx="287.1478" cy="142.7605" r="36.1919" gradientTransform="matrix(1 0 0 1.1891 0 -27.0008)" gradientUnits="userSpaceOnUse">
						<stop offset=".6375" stop-color="#ffd0a0"/>
						<stop offset=".822" stop-color="#ffd1a2"/>
						<stop offset=".8885" stop-color="#ffd3a9"/>
						<stop offset=".9358" stop-color="#ffd8b4"/>
						<stop offset=".9739" stop-color="#ffdec5"/>
						<stop offset="1" stop-color="#ffe4d6"/>
					</radialGradient>
					<radialGradient id="grad-d" cx="286.9079" cy="131.2205" r="36.1919" gradientTransform="matrix(1 0 0 1.1891 0 -24.8182)" gradientUnits="userSpaceOnUse">
						<stop offset=".6435" stop-color="#f2a679" stop-opacity="0"/>
						<stop offset=".9496" stop-color="#f2a679" stop-opacity=".8587"/>
						<stop offset="1" stop-color="#f2a679"/>
					</radialGradient>
					<radialGradient id="grad-e" cx="287.0856" cy="142.3922" r="25.3342" gradientUnits="userSpaceOnUse">
						<stop offset=".6435" stop-color="#e1a77a"/>
						<stop offset=".8629" stop-color="#e0a578"/>
						<stop offset=".9418" stop-color="#db9e72"/>
						<stop offset=".998" stop-color="#d29368"/>
						<stop offset="1" stop-color="#d29267"/>
					</radialGradient>
					<radialGradient id="grad-f" cx="9.8884" cy="142.7605" r="36.1919" gradientTransform="matrix(-1 0 0 1.1891 122.8488 -27.0008)" gradientUnits="userSpaceOnUse">
						<stop offset=".6375" stop-color="#ffd0a0"/>
						<stop offset=".822" stop-color="#ffd1a2"/>
						<stop offset=".8885" stop-color="#ffd3a9"/>
						<stop offset=".9358" stop-color="#ffd8b4"/>
						<stop offset=".9739" stop-color="#ffdec5"/>
						<stop offset="1" stop-color="#ffe4d6"/>
					</radialGradient>
					<radialGradient id="grad-g" cx="9.6486" cy="131.2205" r="36.1919" gradientTransform="matrix(-1 0 0 1.1891 122.8488 -24.8182)" gradientUnits="userSpaceOnUse">
						<stop offset=".6435" stop-color="#f2a679" stop-opacity="0"/>
						<stop offset=".9496" stop-color="#f2a679" stop-opacity=".8587"/>
						<stop offset="1" stop-color="#f2a679"/>
					</radialGradient>
					<radialGradient id="grad-h" cx="9.8263" cy="142.3922" r="25.3342" gradientTransform="matrix(-1 0 0 1 122.8488 0)" gradientUnits="userSpaceOnUse">
						<stop offset=".6435" stop-color="#e1a77a"/>
						<stop offset=".8629" stop-color="#e0a578"/>
						<stop offset=".9418" stop-color="#db9e72"/>
						<stop offset=".998" stop-color="#d29368"/>
						<stop offset="1" stop-color="#d29267"/>
					</radialGradient>
					<radialGradient id="grad-i" cx="200.0588" cy="134.7976" r="78.8774" fx="148.567" fy="75.0461" gradientUnits="userSpaceOnUse">
						<stop offset="0" stop-color="#ffe4d6"/>
						<stop offset=".2889" stop-color="#ffd0a0"/>
						<stop offset=".686" stop-color="#ffd0a0"/>
						<stop offset="1" stop-color="#f2a679"/>
					</radialGradient>
					<radialGradient id="grad-j" cx="199.9471" cy="240.9773" r="95.1727" fx="132.5274" fy="173.8028" gradientTransform="matrix(.8885 0 0 .5688 22.286 64.9234)" gradientUnits="userSpaceOnUse">
						<stop offset="0" stop-color="#ffe4d6"/>
						<stop offset=".050973" stop-color="#ffdec7"/>
						<stop offset=".1902" stop-color="#ffd0a0"/>
						<stop offset=".8006" stop-color="#ffd0a0"/>
						<stop offset="1" stop-color="#f2a679"/>
					</radialGradient>
					<linearGradient id="grad-k" x1="199.8156" x2="200.032" y1="149.5321" y2="172.4624" gradientUnits="userSpaceOnUse">
						<stop offset="0" stop-color="#ffe4d6"/>
						<stop offset=".0517" stop-color="#ffdec7"/>
						<stop offset=".193" stop-color="#ffd0a0"/>
						<stop offset=".5429" stop-color="#f5bf89"/>
						<stop offset=".7332" stop-color="#f7c28d"/>
						<stop offset=".9258" stop-color="#fccb99"/>
						<stop offset="1" stop-color="#ffd0a0"/>
					</linearGradient>
					<path id="mouth-clip" d="M227,205.7h-54 c-1.1,0-2-0.8-2-2s0.9-2,2-2h54c1.1,0,2,0.9,2,2S228.1,205.7,227,205.7z"/>
					<clipPath id="mouth-clip-path">
						<use overflow="visible" xlink:href="#mouth-clip"/>
					</clipPath>
				</defs>
				
				<g id="ear-l">
					<path fill="url(#grad-f)" d="M115.8 176.7c-22-.1-39.8-18-39.8-40 .1-22 18-39.8 40-39.8 42.8.1 42.6 79.9-.2 79.8z"/>
					<path fill="url(#grad-g)" d="M115.8 176.7c-22-.1-39.8-18-39.8-40 .1-22 18-39.8 40-39.8 42.8.1 42.6 79.9-.2 79.8z"/>
					<path fill="url(#grad-h)" d="M114.5 163.4c-14.7 0-26.6-12-26.5-26.7 0-14.7 12-26.6 26.7-26.5 28.5.1 28.4 53.3-.2 53.2z"/>
				</g>
				<g id="ear-r">
					<path fill="url(#grad-c)" d="M284.3 176.7c22-.1 39.8-18 39.8-40-.1-22-18-39.8-40-39.8-42.8.1-42.6 79.9.2 79.8z"/>
					<path fill="url(#grad-d)" d="M284.3 176.7c22-.1 39.8-18 39.8-40-.1-22-18-39.8-40-39.8-42.8.1-42.6 79.9.2 79.8z"/>
					<path fill="url(#grad-e)" d="M285.6 163.4c14.7 0 26.6-12 26.5-26.7s-12-26.6-26.7-26.5c-28.5.1-28.4 53.3.2 53.2z"/>
				</g>
				<path fill="url(#grad-a)" d="M281 203c-6 32.7-153 34-162 0-7-30.6-9-57-9-80.6 0-43.9 19-79.4 89.9-79.4S290 78.6 290 122.4c.2 25.7-3.2 52.7-9 80.6z"/>
				<path fill="#7E4B22" d="M223.7 34.6c-1.6 2.6-3.6 5-5.8 7.3-2.2 2.2-4.7 4.2-7.5 5.9-2.8 1.7-5.7 3.2-8.9 4.2-1.6.6-3.2 1-4.8 1.4-.8.2-1.6.3-2.5.5l-2.5.4.1-10 2 .2c.7.1 1.4.2 2 .2 1.4 0 2.8.1 4.1 0 2.8-.1 5.6-.6 8.3-1.4 2.8-.8 5.5-1.9 8.1-3.3 2.7-1.6 5.2-3.3 7.4-5.4z"/>
				<path fill="#7E4B22" d="M215.2 28.2c0 2.3-.3 4.7-.9 7-.6 2.3-1.4 4.7-2.6 6.9-1.2 2.2-2.6 4.4-4.3 6.4-1.7 2-3.7 3.8-5.8 5.5l-5.4-10.7c1.8-.4 3.7-.9 5.5-1.8 1.8-.8 3.6-1.9 5.2-3.1 1.7-1.3 3.2-2.8 4.6-4.5 1.6-1.7 2.8-3.6 3.7-5.7z"/>
				<path id="head-lower" fill="url(#grad-b)" d="M294.2 192.3c-2.1-14.6-17.9-38.3-42-38.3H147.8c-24.1 0-39.9 23.7-42 38.3-1.7 11.9-9 67.7 94.2 67.7s95.9-55.8 94.2-67.7z"/>
				<path id="face-upper" fill="url(#grad-i)" d="M199.8 83.2c-33.5-40.3-91.5.7-65.5 90.4 11.6 36.8 117.6 38.7 131.3-1.1 26.1-89.7-30.8-128.4-65.8-89.3z"/>
				<path id="face-lower" fill="url(#grad-j)" d="M279.3 189.8C276.1 166 249.5 158 200 158s-75.5 9-79.4 31.8c-1.6 9.8-7.5 56.2 79.3 56.2 87 0 80.8-46.3 79.4-56.2z"/>
				<g id="nose">					
					<path fill="url(#grad-k)" d="M220.1 165.3c-2.2-9-10.3-15.8-20.1-15.8-9.7 0-17.8 6.7-20.1 15.8-1.5 6.4 7 9 20.1 9 13.1-.1 21.3-3.1 20.1-9z"/>
					<path fill="none" stroke="#806850" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="5" d="M208.4 161.1s-2.6 1-4 4"/>
					<path fill="none" stroke="#806850" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="5" d="M191.4 161.1s2.6 1 4 4"/>
				</g>
				<path id="eyebrow-l" fill="#603416" d="M159,108.1c5.9,0,11.1,2.8,14.8,7.3c-2.1-5.2-5.8-9.1-10.4-10.7c-1.4-0.5-2.9-0.7-4.4-0.7 c-6.5,0-12.1,4.7-14.8,11.4C147.9,111,153.1,108.1,159,108.1z"/>
				<path id="eyebrow-r" fill="#603416" d="M241,108.1c-5.9,0-11.1,2.8-14.8,7.3c2-4.9,5.4-8.7,9.7-10.4c1.6-0.6,3.3-1,5.1-1c6.5,0,12.1,4.7,14.8,11.4 C252.1,111,246.9,108.1,241,108.1z"/>
				<g id="eye-r">
					<g class="outer">
						<ellipse cx="241" cy="130.9" fill="#F2A679" rx="16.5" ry="16.4"/>
						<ellipse cx="241" cy="132.8" fill="#FFF" rx="15" ry="15.8"/>
					</g>
					<g class="inner">
						<ellipse cx="239" cy="136.3" fill="#5397D1" rx="10" ry="10.5"/>
						<ellipse cx="239" cy="136.9" rx="6.1" ry="6.4"/>
						<circle cx="244.1" cy="132.7" r="2" fill="#FFF"/>
					</g>
				</g>
				<g id="eye-l">
					<g class="outer">
						<ellipse cx="159" cy="130.9" fill="#F2A679" rx="16.5" ry="16.4"/>
						<ellipse cx="159" cy="132.8" fill="#FFF" rx="15" ry="15.8"/>
					</g>
					<g class="inner">
						<ellipse cx="161" cy="136.3" fill="#5397D1" rx="10" ry="10.5"/>
						<ellipse cx="161" cy="136.9" rx="6.1" ry="6.4"/>
						<circle cx="165.2" cy="132.7" r="2" fill="#FFF"/>
					</g>
				</g>
				<g id="mouth" clip-path="url(#mouth-clip-path)">
					<path fill="#7F1827" d="M144 174.2h117.1v62.5H144z" />
					<rect id="teeth-bot" x="153.5" y="209.7" fill="#FFFFFF" width="93" height="31.7"/>
					<rect id="teeth-top" x="153.5" y="179" fill="#FFFFFF" width="93" height="19.7"/>
				</g>
				<path id="mouth-outline" fill="none" stroke="#F2A679" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M227,205.7h-54 c-1.1,0-2-0.8-2-2s0.9-2,2-2h54c1.1,0,2,0.9,2,2S228.1,205.7,227,205.7z"/>
			</svg>
		</div>
	</div>
	
	<div id="emotion_container">
		<div id="emotion_icons">
			<span class="emotion_icon" id="icon1">😠</span>
			<span class="emotion_icon" id="icon2">😞</span>
			<span class="emotion_icon" id="icon3">😲</span>
			<span class="emotion_icon" id="icon4">😀</span>
		</div>
		<div id="controls">
			<input class="btn" type="button" value="wait, loading video" disabled="disabled" onclick="startVideo()" id="startbutton" />
		</div>
	</div>
</div>




              
            
!

CSS

              
                body, html {
	font-family: 'Lato';
	background-color: #f0f0f0;
	width: 100%; height: 100%;
}
body {
	display: flex; flex-flow: row nowrap; justify-content: center; align-items: center;
}

#container {
	box-sizing: border-box;
	flex: 0 0 auto;
	position: relative;
	#video-container {
		padding: 0; box-sizing: border-box;
		position: relative; position: absolute; top: 0; left: 0;
		width: auto; height: auto;
		flex: 0 0 auto;
		#video {
			box-sizing: border-box;
			width: 100%; width: 400px; height: 300px; width: 200px; height: 150px;
			transform : scaleX(-1);
		}
		#overlay {
			box-sizing: border-box;
			width: 100%; height: 100%;
			position: absolute; top: 0px; left: 0px;
			transform : scaleX(-1);
		}
	}
	#svg-container {
		width: 800px;
		background-color: white;
		div {
			position: relative;
			height: 0;
			padding-bottom: 75%;
			svg {
				position: absolute; top: 0; left: 0;
				width: 100%; height: 100%;
			}
		}
	}
}





#emotion_container {
	#emotion_icons {
		padding: 1rem;
		font-size: 3rem;
		display: flex; flex-flow: row nowrap; justify-content: space-between; align-items: center;
	}
	.emotion_icon {
		flex: 0 0 auto;
	}
	#emotion_chart, #emotion_icons {
		margin: 0 auto;
		width : 400px;
	}
	#icon1, #icon2, #icon3, #icon4, #icon5, #icon6 {
		visibility : visible;
	}
	#controls {
		text-align: center;
		.btn {
			padding: 1rem 2rem;
			font-size: 12em;
		}
	}
}
              
            
!

JS

              
                console.clear();

var vid = document.getElementById('video');
var vid_width = vid.width;
var vid_height = vid.height;
var overlay = document.getElementById('overlay');
var overlayCC = overlay.getContext('2d');

var mouthClip = document.getElementById('mouth-clip');
var mouthOutline = document.getElementById('mouth-outline');
var eyeRInner = document.querySelector('#eye-r .inner'), eyeROuter = document.querySelector('#eye-r .outer');
var eyeLInner = document.querySelector('#eye-l .inner'), eyeLOuter = document.querySelector('#eye-l .outer');
var eyebrowL = document.getElementById('eyebrow-l'), eyebrowR = document.getElementById('eyebrow-r');
var earL = document.getElementById('ear-l'), earR = document.getElementById('ear-r');
var headLower = document.getElementById('head-lower'), faceLower = document.getElementById('face-lower');
var nose = document.getElementById('nose');
var teethTop = document.getElementById('teeth-top'), teethBot = document.getElementById('teeth-bot');

var mouthNormal = "M227,205.7h-54 c-1.1,0-2-0.8-2-2s0.9-2,2-2h54c1.1,0,2,0.9,2,2S228.1,205.7,227,205.7z";
var mouthHappy = "M197.8,218.5 c-30.5-0.8-39.8-16.6-42.6-26.2c-1-3.3,2-6.4,5.3-5.7c26.4,5.6,52.7,5.6,79.1,0c3.3-0.7,6.2,2.4,5.3,5.7 c-2.8,9.6-11.9,25.4-42.4,26.2C201.7,218.5,198.5,218.5,197.8,218.5z";
var mouthSurprised = "M192,204 c0-4.1,3.4-7.5,7.5-7.5h1c4.1,0,7.5,3.4,7.5,7.5c0,4.1-3.4,7.5-7.5,7.5h-1C195.4,211.5,192,208.1,192,204z";
var mouthSad = "M227.3,208.1 c-15.5-13.9-39.1-13.9-54.6,0c-0.9,0.8-2.3,1-3.1,0.2c-0.8-0.8-0.6-2.2,0.4-3.2c17-15.2,42.9-15.2,59.9,0c1.1,0.9,1.2,2.4,0.4,3.2 C229.6,209.1,228.3,208.9,227.3,208.1z";
var mouthAngry = "M217,211.9h-34 c-7.2,0-13-5.8-13-13c0-7.2,5.8-13,13-13h34c7.2,0,13,6.1,13,13S224.2,211.9,217,211.9z";

/********** check and set up video/webcam **********/

function enablestart() {
	var startbutton = document.getElementById('startbutton');
	startbutton.value = "start";
	startbutton.disabled = null;
}

function adjustVideoProportions() {
	// resize overlay and video if proportions are different
	// keep same height, just change width
	var proportion = vid.videoWidth/vid.videoHeight;
	vid_width = Math.round(vid_height * proportion);
	vid.width = vid_width;
	overlay.width = vid_width;
}

function gumSuccess( stream ) {
	// add camera stream if getUserMedia succeeded
	if ("srcObject" in vid) {
		vid.srcObject = stream;
	} else {
		vid.src = (window.URL && window.URL.createObjectURL(stream));
	}
	vid.onloadedmetadata = function() {
		adjustVideoProportions();
		vid.play();
	}
	vid.onresize = function() {
		adjustVideoProportions();
		if (trackingStarted) {
			ctrack.stop();
			ctrack.reset();
			ctrack.start(vid);
		}
	}
}

function gumFail() {
	alert("There was some problem trying to fetch video from your webcam. If you have a webcam, please make sure to accept when the browser asks for access to your webcam.");
}

navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
window.URL = window.URL || window.webkitURL || window.msURL || window.mozURL;

// check for camerasupport
if (navigator.mediaDevices) {
	navigator.mediaDevices.getUserMedia({video : true}).then(gumSuccess).catch(gumFail);
} else if (navigator.getUserMedia) {
	navigator.getUserMedia({video : true}, gumSuccess, gumFail);
} else {
	alert("This demo depends on getUserMedia, which your browser does not seem to support. :(");
}

vid.addEventListener('canplay', enablestart, false);


/*********** setup of emotion detection *************/
// set eigenvector 9 and 11 to not be regularized. This is to better detect motion of the eyebrows
pModel.shapeModel.nonRegularizedVectors.push(9);
pModel.shapeModel.nonRegularizedVectors.push(11);

var ctrack = new clm.tracker({useWebGL : true});
ctrack.init(pModel);
var trackingStarted = false;

function startVideo() {
	// start video
	vid.play();
	// start tracking
	ctrack.start(vid);
	trackingStarted = true;
	// start loop to draw face
	drawLoop();
}

function drawLoop() {
	window.requestAnimationFrame(drawLoop);
	overlayCC.clearRect(0, 0, vid_width, vid_height);
	if (ctrack.getCurrentPosition()) {
		ctrack.draw(overlay);
	}
	var cp = ctrack.getCurrentParameters();

	var er = ec.meanPredict(cp);
	if (er) {
		var winner = {value: 0, emotion: ""};
		for (var i = 0;i < er.length;i++) {
			if (er[i].value > 0.5) {
				if(winner.value < er[i].value) {
					winner = er[i];
				} else {
				}
				document.getElementById('icon'+(i+1)).style.visibility = 'visible';
			} else {
				document.getElementById('icon'+(i+1)).style.visibility = 'hidden';
			}
		}
		animateFace(winner.emotion);
	}
}

function animateFace(emotion) {
	switch(emotion) {
		case "happy":
			//console.log("happy");
			TweenMax.to([mouthClip, mouthOutline], .25, {morphSVG: mouthHappy});
			TweenMax.to([eyeLOuter, eyeROuter], .25, {y: -8, scaleY: 1.25});
			TweenMax.to([eyeLInner, eyeRInner], .25, {y: -5, scaleY: 1.23});
			TweenMax.to(eyebrowL, .25, {rotation: "-20deg", x: -6, y: -10, scaleX: 1});
			TweenMax.to(eyebrowR, .25, {rotation: "20deg", x: 6, y: -10, scaleX: 1});
			TweenMax.to(earL, .25, {x: -3, y: -10});
			TweenMax.to(earR, .25, {x: 3, y: -10});
			TweenMax.to(headLower, .25, {y: -5, scaleX: 1.09, scaleY: .9});
			TweenMax.to(faceLower, .25, {y: -5, scaleX: 1.125, scaleY: .88});
			TweenMax.to(nose, .25, {y: -3});
			TweenMax.to(teethTop, .25, {y: 0});
			TweenMax.to(teethBot, .25, {y: 0});
			break;
		case "surprised":
			//console.log("surprised");
			TweenMax.to([mouthClip, mouthOutline], .25, {morphSVG: mouthSurprised});
			TweenMax.to([eyeLOuter, eyeROuter], .25, {y: -13, scaleY: 1.38});
			TweenMax.to([eyeLInner, eyeRInner], .25, {y: -8, scaleY: 1.36});
			TweenMax.to(eyebrowL, .25, {rotation: "0deg", x: 0, y: -17, scaleX: 1});
			TweenMax.to(eyebrowR, .25, {rotation: "0deg", x: 0, y: -17, scaleX: 1});
			TweenMax.to(earL, .25, {x: 0, y: 0});
			TweenMax.to(earR, .25, {x: 0, y: 0});
			TweenMax.to(headLower, .25, {y: 4, scaleX: .89, scaleY: 1.05});
			TweenMax.to(faceLower, .25, {y: 4, scaleX: .875, scaleY: 1.06});
			TweenMax.to(nose, .25, {y: -2});
			TweenMax.to(teethTop, .25, {y: -3});
			TweenMax.to(teethBot, .25, {y: 3});
			break;
		case "sad":
			//console.log("sad");
			TweenMax.to([mouthClip, mouthOutline], .25, {morphSVG: mouthSad});
			TweenMax.to([eyeLOuter, eyeROuter], .25, {y: 6, scaleY: .88});
			TweenMax.to([eyeLInner, eyeRInner], .25, {y: 5, scaleY: .85});
			TweenMax.to(eyebrowL, .25, {rotation: "0deg", x: 0, y: 8, scaleX: 1});
			TweenMax.to(eyebrowR, .25, {rotation: "0deg", x: 0, y: 8, scaleX: 1});
			TweenMax.to(earL, .25, {x: 0, y: 0});
			TweenMax.to(earR, .25, {x: 0, y: 0});
			TweenMax.to(headLower, .25, {y: 2, scaleX: 1, scaleY: 1});
			TweenMax.to(faceLower, .25, {y: 2, scaleX: 1, scaleY: 1});
			TweenMax.to(nose, .25, {y: 1});
			TweenMax.to(teethTop, .25, {y: -6});
			TweenMax.to(teethBot, .25, {y: 0});
			break;
		case "angry":
			//console.log("angry");
			TweenMax.to([mouthClip, mouthOutline], .25, {morphSVG: mouthAngry});
			TweenMax.to([eyeLOuter, eyeROuter], .25, {y: 12, scaleY: .67});
			TweenMax.to([eyeLInner, eyeRInner], .25, {y: 5, scaleY: .85});
			TweenMax.to(eyebrowL, .25, {rotation: "27deg", x: 8, y: 15, scaleX: 1.5});
			TweenMax.to(eyebrowR, .25, {rotation: "-27deg", x: -8, y: 15, scaleX: 1.5});
			TweenMax.to(earL, .25, {x: -6, y: -6});
			TweenMax.to(earR, .25, {x: 6, y: -6});
			TweenMax.to(headLower, .25, {y: -2, scaleX: 1.07, scaleY: .95});
			TweenMax.to(faceLower, .25, {y: -2, scaleX: 1.09, scaleY: .92});
			TweenMax.to(nose, .25, {y: -4});
			TweenMax.to(teethTop, .25, {y: -1});
			TweenMax.to(teethBot, .25, {y: -9});
			break;
		default:
			//console.log("normal");
			TweenMax.to([mouthClip, mouthOutline], .25, {morphSVG: mouthNormal});
			TweenMax.to([eyeLOuter, eyeROuter], .25, {y: 0, scaleY: 1});
			TweenMax.to([eyeLInner, eyeRInner], .25, {y: 0, scaleY: 1});
			TweenMax.to([eyebrowL, eyebrowR], .25, {x: 0, y: 0, rotation: "0deg", scaleX: 1});
			TweenMax.to([earL, earR], .25, {x: 0, y: 0});
			TweenMax.to([headLower, faceLower], .25, {y: 0, scaleX: 1, scaleY: 1});
			TweenMax.to(nose, .25, {y: 0});
			TweenMax.to([teethBot, teethTop], .25, {y: 0});
	}
}

delete emotionModel['disgusted'];
delete emotionModel['fear'];
var ec = new emotionClassifier();
ec.init(emotionModel);
var emotionData = ec.getBlank();

TweenMax.set([eyeLOuter, eyeROuter], {transformOrigin: "center top"});
TweenMax.set([eyeLInner, eyeRInner], {transformOrigin: "center top"});
TweenMax.set(eyebrowL, {svgOrigin: "159px 105px"});
TweenMax.set(eyebrowR, {svgOrigin: "241px 105px"});
TweenMax.set([headLower, faceLower], {transformOrigin: "50% 50%"});
TweenLite.defaultEase = Quad.easeOut;

var tl = new TimelineMax({paused: true, repeat: -1, yoyo: true});
tl.addCallback(function() {
	animateFace("surprised");
}, "0");
tl.addCallback(function() {
	animateFace("normal");
}, "1");
//tl.play();



/******** stats ********/
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
stats.domElement.style.right = '0px';
document.getElementById('container').appendChild( stats.domElement );

// update stats on every iteration
document.addEventListener('clmtrackrIteration', function(event) {
	stats.update();
}, false);

              
            
!
999px

Console