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="background">
	<div class="wrapper">
		<div class="layer layer--poster layer--1"></div>
		
		<div class="layer layer--luke-face layer--1"></div>
		<div class="layer layer--luke-nose layer--2"></div>
		<div class="layer layer--luke-hood layer--4"></div>

		<div class="layer layer--kylo-hair-back layer--4"></div>
		<div class="layer layer--kylo-face layer--5"></div>
		<div class="layer layer--kylo-hair-front layer--6"></div>
	  <div class="layer layer--kylo-body layer--7"></div>
		<div class="layer layer--kylo-hand layer--10"></div>
		<div class="layer layer--kylo-saber layer--10"></div>

		<div class="layer layer--rey-body layer--8"></div>
		<div class="layer layer--rey-arm layer--12"></div>
		<div class="layer layer--rey-saber layer--12"></div>
		
		<div class="layer layer--chewie-guards layer--15"></div>
		
		<div class="layer layer--leia layer--18"></div>
		
		<div class="layer layer--characters layer--23"></div>

		<div class="layer layer--title layer--20"></div>
		<div class="layer layer--title layer--21"></div>
		<div class="layer layer--title layer--22"></div>
		<div class="layer layer--title layer--23"></div>
		<div class="layer layer--title layer--24"></div>
		<div class="layer layer--title layer--25"></div>
		<div class="layer layer--title layer--26"></div>
		<div class="layer layer--title layer--27"></div>
		<div class="layer layer--title layer--28"></div>
		
		<div class="layer layer--tlj layer--25"></div>
	</div>
</div>

<svg id="svg" style="position: absolute; top: -999999px">
  <filter id="heat" filterUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
    <feTurbulence id="heatturb" type="fractalNoise" numOctaves="1" seed="2" baseFrequency="0.025 0.01"></feTurbulence>
    <feDisplacementMap xChannelSelector="G" yChannelSelector="B" scale="22" in="SourceGraphic"></feDisplacementMap>
  </filter>
</svg>
              
            
!

CSS

              
                
$assets: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/436243';
$darken: rgba(#000,.05);

html {
	height: 100%;
	display: flex;
}

body {
	position: relative;
	margin: auto;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background-color: #030001;
}

.background {
	flex-shrink: 0;
	width: 1022px;
	height: 575px;
	position: relative;
	margin: auto;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background-image: radial-gradient(ellipse at center, 
		                                transparent 0,
		                                transparent 20%,
		                                #030001 95%,
	                                  #030001 100%),
										linear-gradient(to top, 
											              $darken 0, 
											              $darken 100%),
		                url(#{$assets}/bg.jpg);
	background-size: 100%;
	background-position: center;
	background-repeat: no-repeat;
}

.wrapper {
	--x: 0;
	--y: 0;
	position: relative;
	width: 388px;
	height:  575px;
	cursor: pointer;
	filter: brightness(calc(1 - var(--y) * .15 + .1));
}

.layer {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	transform-origin: 50% 50%;
	border-radius: 3px;

	&--poster {
		background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/436243/poster-blanked-min.jpg);
		box-shadow: 0 60px 80px rgba(0,0,0,0.1),
			          0 20px 40px rgba(0,0,0,0.05);
		.wrapper:active & {
			box-shadow: 0 1px 3px rgba(0,0,0,0.3);
		}
	}

	&--luke-face { background-image: url(#{$assets}/luke-face_copy.png); }
	&--luke-nose { background-image: url(#{$assets}/luke-nose.png);      }
	&--luke-hood { 
		background-image: url(#{$assets}/luke-hood.png); 
		filter: url('#heat'); 
	}
	
	&--kylo-hair-back  { 
		background-image: url(#{$assets}/kylo-hair-back.png);
		filter: url('#heat'); 
	}
	&--kylo-face { background-image: url(#{$assets}/kylo-face_copy.png);  }
	&--kylo-hair-front { 
		background-image: url(#{$assets}/kylo-hair-front.png);
		filter: url('#heat'); 
	}
	&--kylo-body { 
		background-image: url(#{$assets}/kylo-body.png); 
		animation: 1s ease-out 0s infinite body-breathe--7;
	}
	&--kylo-hand { background-image: url(#{$assets}/kylo-hand.png); }
	&--kylo-saber { 
		animation: wild-saber-glow 0.075s infinite;
		background-image: url(#{$assets}/kylo-saber.png); 
	}
	
	&--rey-body { background-image: url(#{$assets}/rey-body.png); }
	&--rey-arm  { background-image: url(#{$assets}/rey-arm.png);  }
	&--rey-saber {
		animation: saber-glow .075s infinite;
		background-image: url(#{$assets}/rey-saber.png);
	}
	
	&--chewie-guards { background-image: url(#{$assets}/chewie-guards.png);  }
	
	&--leia { background-image: url(#{$assets}/leia.png);  }
	
	&--characters { background-image: url(#{$assets}/characters-min.png);  }
	
	&--title { background-image: url(#{$assets}/title.png); }
	
	&--tlj { background-image: url(#{$assets}/tlj-min.png); }
	
	background-size: 100%;
	background-position: center;
	background-repeat: no-repeat;
} 

@for $i from 1 to 50 {
	.layer--#{$i} { 
		transform: translateX(calc(var(--x) * #{$i}px)) 
							 translateY(calc(var(--y) * #{$i}px))
							 rotateX(calc(var(--y) * -20deg)) 
							 rotateY(calc(var(--x) * 20deg));
		.wrapper:active & {
			transform: translateX(calc(var(--x) * #{$i}px)) 
							   translateY(calc(var(--y) * #{$i}px + 1px))
								 rotateX(calc(var(--y) * -20deg)) 
								 rotateY(calc(var(--x) * 20deg));
		}
	}
}

@keyframes saber-glow {
	0%   { opacity: 1;   filter: brightness(1);    }
	50%  { opacity: .87; filter: brightness(.97);  }
	65%  { opacity: 1;   filter: brightness(1.2);  }
	80%  { opacity: .78; filter: brightness(1);  }
	85%  { opacity: 1;   filter: brightness(1.3); }
	100% { opacity: 1;   filter: brightness(1);    }
}

@keyframes wild-saber-glow {
	0%   { opacity: 1;   filter: brightness(1);    }
	50%  { opacity: .87; filter: brightness(.97);  }
	65%  { opacity: 1;   filter: brightness(2) blur(4px);  }
	80%  { opacity: .78; filter: brightness(1);  }
	85%  { opacity: 1;   filter: brightness(1.8) blur(1px); }
	100% { opacity: 1;   filter: brightness(1);    }
}
              
            
!

JS

              
                let raf, bf, bfx, bfy;
let frames = 0;
let rad = Math.PI / 180;
let start = { x: 0, y: 0 };
let end   = { x: 0, y: 0 };
let last  = { x: window.innerWidth / 2, y: window.innerHeight / 2};
const frame = document.querySelector('.wrapper');
const feTurb = document.querySelector('#heatturb');
const timeline = new TimelineMax({ repeat: -1, yoyo: true });
timeline.to(feTurb, 5, {
	attr: { baseFrequency: "0.028 0.014" },
	ease: Linear.easeNone
});

const lerp = (start, end) => ({
 	x: start.x + ((end.x - start.x) * 0.1),
	y: start.y + ((end.y - start.y) * 0.1),
});

const update = () => {
  frame.style.setProperty('--x', start.x );
  frame.style.setProperty('--y', start.y );
  raf = null;
};

document.addEventListener('mousemove', e => {
	let cX = e.clientX;
	let cY = e.clientY;
	last = { x: cX, y: cY };
	end = {
		x: ((cX / window.innerWidth) - 0.5) * 2,
		y: ((cY / window.innerHeight) - 0.5) * 2
	};
	start = lerp(start, end);
  raf = raf || requestAnimationFrame(update);
});

setInterval(() => {
	const event = new MouseEvent('mousemove', {
		clientX: last.x,
		clientY: last.y,
		buttons: 1
	});
	document.dispatchEvent(event);
}, 16);

requestAnimationFrame(update);
              
            
!
999px

Console