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 class="container">
		<div class="me">
			<div class="hair"></div>
			<div class="clothes">
				<div class="jumper"></div>
			</div>
			<div class="neck"></div>
			<div class="head"><div class="bangs"></div></div>
		</div>
		<div class="mouse"><i class="fa fa-mouse-pointer" aria-hidden="true"></i></div>
		<p>move</p>
	</div>
              
            
!

CSS

              
                @import 'compass/css3';
@import url('https://fonts.googleapis.com/css?family=Archivo+Black');

@mixin keyframes($animationName) {
  @-webkit-keyframes #{"$animationName"} {
    @content;
  }
  @-moz-keyframes #{$animationName} {
    @content;
  }

  @-ms-keyframes #{$animationName} {
    @content;
  }

  @keyframes #{$animationName} {
    @content;
  }
}

$font : 'Archivo Black';
$flesh : #ffd3c1;//#f3d1bc;
$hair : #111427;
$yellow : #d09233;
$bg:#d43959;
$blue:#607789;
html, body {
	height:100%;
	width:100%;
	background:$bg;
	overflow:hidden;
	padding:0;
	margin:0;
}
.container {
	text-align:center;
	position:absolute;
	left:0;
	right:0;
	margin:auto;
	top:0;
	bottom:0;
	width:100%;
	height:200px;
	div {position:absolute}
	.me {	
		left: 0;
		position: absolute;
		right: 0;
		margin: auto;
		width: 80px;
		height: 160px;

		$bangs_height : 50;
		$bangs_top : -12;
		$bangs_width : 94%;
		$head_height : 90;
		$head_width : 70;
		$head_top : 10;

		.head {
			@include transition(all 0.5s ease);
			width:$head_width +px;
			height:$head_height+px;
			background:$flesh;
			@include border-radius(100px);
			top:$head_top+px;
			left:5px;
			.bangs {
				@include transition(all 0.5s ease);
				height: $bangs_height+px;
				width:$bangs_width;
				background:$hair;
				content:"";
				position:absolute;
				@include border-radius(100px 100px 10px 10px);
				top: $bangs_top+px;
				left: 3px;
			}
		} //end of head

		.look-left {
			&.head {
				width:($head_width) +px;
				left:-10px;
				.bangs {
					width:$bangs_width + 12;
					left: -7px;
				}
			}
		}

		.look-right {
			&.head {
				width:($head_width) +px;
				left: 15px;
				.bangs {
					width:$bangs_width + 12;
					left: 5px;
				}
			}
		}

		.look-down {
			&.head {
				height: $head_height + px;
				top: $head_top + 10 + px;
				width: $head_width + px;
				left: 5px;
				@include transform-origin(bottom center);
				.bangs {
					height:80px;
					top: $bangs_top - 20 +px
				}
			}
		}

		.look-up {
			&.head {
				height: $head_height + px;
				top: $head_top - 10 + px;
				width: $head_width + px;
				left: 5px;
				@include transform-origin(bottom center);
				.bangs {
					height:40px;
					top: $bangs_top +px
				}
			}
		}

		.look-down-right {
			&.head {
				top: $head_top +10 +px;
				left: 25px;
				width: $head_width +px;
				@include transform(rotate(10deg));
				@include transform-origin(bottom left);
				.bangs {
					height:$bangs_height+10 +px;
					width: $bangs_width+12;
				}
			}
		}

		.look-up-right {
			&.head {
				height: $head_height + px;
				top: $head_top - 10 + px;
				width: $head_width + px;
				left: 15px;
				@include transform-origin(bottom center);
				@include transform(rotate(-15deg));
				.bangs {
					width: $bangs_width +11;
					height:40px;
					top: $bangs_top +px;
					left: 5px;
				}
			}
		}

		.look-down-left {
			&.head {
				top: $head_top +10 +px;
				left: -15px;
				width: $head_width +px;
				@include transform(rotate(-10deg));
				@include transform-origin(bottom right);
				.bangs {
					height:$bangs_height+10 +px;
					width: $bangs_width+12;
					left: -10px;
				}
			}
		}


		.look-up-left {
			&.head {
				height: $head_height + px;
				top: $head_top - 10 + px;
				width: $head_width + px;
				left: -10px;
				@include transform-origin(bottom center);
				@include transform(rotate(15deg));
				.bangs {
					width: $bangs_width +11;
					height:40px;
					top: $bangs_top +px;
					left: -10px;
				}
			}
		}
		.neck {
			height: 60px;
			width: 20px;
			position:absolute;
			@include border-radius(0px 0px 100px 100px);
			background: $flesh;
			top: 60px;
			left: 30px;
			overflow:hidden;
			&:before {
				content:"";
				position:absolute;
				width:60px;
				height: 60px;
				@include border-radius(100%);
				top:-12px;
				background:$flesh - 20;
				left: -18px;
				@include transition(all 0.5s ease)
			}

			&.look-left:before {
				left: -38px;
			}
			&.look-right:before {
				left: -5px;
			}
			&.look-down:before {
				top:-5px
			}
			&.look-up:before {
				top:-22px
			}

			&.look-down-right:before {
				left: -2px;
				top:-5px
			}

			&.look-up-right:before {
				left: -10px;
				top:-20px
			}

			&.look-down-left:before {
				left: -38px;
				top:-5px
			}

			&.look-up-left:before {
				left: -38px;
				top:-20px
			}
		}

		.hair {
			@include transition(all 0.5s ease);
			position: absolute;
			height: 170px;
			width: 105px;
			@include border-radius(45px);
			background:$hair;
			left: -12px;
			top: -12px;
			overflow:hidden;
			&:after {
				content:"";
				position: absolute;
				width:80px;
				height: 160px;
				background: $hair - 10;
				@include border-radius(25px);
				top: 60px;
				left: 12px;
			}

			&.look-left {
				left: -5px;
				width:100px;
				&:after {
				}
			}

			&.look-right {
				left: -17px;
				width:100px
			}
			&.look-down {
				top:-12px;
				height: 165px;
			}
			&.look-up {
				top:-8px;
				height: 180px;
			}
			&.look-down-right {
				@include transform(rotate(10deg));
			}

			&.look-up-right {
				left: -25px;
				top:-8px;
				height: 180px;
			}
			&.look-down-left {
				@include transform(rotate(-10deg));
			}

			&.look-up-left {
				left: -8px;
				top:-8px;
				height: 180px;
			}
		} //end of hair
		
		.clothes {
			background:$yellow;
			width: 80px;
			height: 40px;
			@include border-radius(100px 100px 10px 10px);
			top: 105px;
			overflow:hidden;

			.jumper {
				width: 60px;
				height: 100%;
				top: 60%;
				background: $blue;
				left: 0;
				right: 0;
				margin:auto;
				&:before {
					background: $blue;
					width:10px;
					height:50px;
					content:"";
					position:absolute;
					top: -40px;
					left: 0px;
				}
				&:after {
					background: $blue;
					width:10px;
					height:50px;
					content:"";
					position:absolute;
					top: -40px;
					left: 50px;
				}
			}
		}
	}
	p {
		color:$bg + 30;
		margin-top: 180px;
		font-family: $font;
		font-size: 20px;
		text-transform:uppercase;
		text-align:center
	}

	.mouse {
		color: #fff;
		font-size: 30px;
		left: 0;
		right: 0;
		top: 210px;
		width: 150px;
		height: 150px;
		margin: auto;
		@include animation(mouseAction 5s linear);
		@include transform(rotate(0deg));
		opacity: 0;

		i.fa {
			@include transition(all 0.5s ease);
			@include animation(mouseAction2 5s linear);
			@include transform(rotate(0deg));
			@include text-shadow(-4px 6px 0px rgba(0, 0, 0, 0.34))
		}
	}

} //end of container


@include keyframes(mouseAction) {
	0%{opacity:1}
	99.9%{opacity:1}
	100%{@include transform(rotate(1080deg));opacity:0}
}
@include keyframes(mouseAction2) {
	100%{@include transform(rotate(-1080deg))}
}
              
            
!

JS

              
                
var classes_to_remove = ["look-right","look-left", "look-down", "look-up","look-down-right","look-down-left","look-up-right","look-up-left"];

function removeClasses () {
	for(var x = 0;x<classes_to_remove.length;x++) {
		$(".head").removeClass(classes_to_remove[x]);
		$(".hair").removeClass(classes_to_remove[x]);
		$(".neck").removeClass(classes_to_remove[x]);
	}
}

function direction(e) {
	//look left
	if( e.clientX<= window.innerWidth/2) { 
		removeClasses();

		$(".head").addClass("look-left");
		$(".hair").addClass("look-left");
		$(".neck").addClass("look-left");
	}
 	//look right
	if( e.clientX >= (window.innerWidth-(window.innerWidth/2))) { 
		removeClasses();

		$(".head").addClass("look-right");
		$(".hair").addClass("look-right");
		$(".neck").addClass("look-right");
	}
  	//look down
	if( e.clientY >= (window.innerHeight -(window.innerHeight/2.5))) {
		removeClasses();

		$(".head").addClass("look-down");
		$(".hair").addClass("look-down");
		$(".neck").addClass("look-down");
	}

	// look up  
	if( e.clientY <= ((window.innerHeight/2.5))) { 
		removeClasses();

		$(".head").addClass("look-up");
		$(".hair").addClass("look-up");
		$(".neck").addClass("look-up");
	}

	// look down right 
	if( e.clientY >= (window.innerHeight -(window.innerHeight/2.5)) && e.clientX >= (window.innerWidth-(window.innerWidth/3))) { 
		removeClasses();

		$(".head").addClass("look-down-right");
		$(".hair").addClass("look-down-right");
		$(".neck").addClass("look-down-right");
	}

	// look down left
	if( e.clientY >= (window.innerHeight -(window.innerHeight/2.5)) &&  e.clientX<= window.innerWidth/3) {
		removeClasses();

		$(".head").addClass("look-down-left");
		$(".hair").addClass("look-down-left");
		$(".neck").addClass("look-down-left");
	}

	// look up right 
	if( e.clientY <= ((window.innerHeight/2.5)) && e.clientX >= (window.innerWidth-(window.innerWidth/3))) { 
		removeClasses();

		$(".head").addClass("look-up-right");
		$(".hair").addClass("look-up-right");
		$(".neck").addClass("look-up-right");
	}

	// look down left
	if( e.clientY <= ((window.innerHeight/2.5)) &&  e.clientX<= window.innerWidth/3) {
		removeClasses();

		$(".head").addClass("look-up-left");
		$(".hair").addClass("look-up-left");
		$(".neck").addClass("look-up-left");
	}

	if( e.clientX >  window.innerWidth/3 &&  e.clientX < (window.innerWidth - (window.innerWidth/3)) && 
	 e.clientY >  window.innerHeight/2.5 &&  e.clientY < (window.innerHeight - (window.innerHeight/2.5)) ) {
		removeClasses();
	}
}
window.addEventListener("mousemove", function (e) {
  	direction(e);
})

              
            
!
999px

Console