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="ken-burns">
	<section data-background="https://picsum.photos/id/377/1920/1080">
		<h1>Lorem ipsum dolor sit amet</h1>
		<p>Nulla porta enim eu convallis tincidunt. Pellentesque porttitor sagittis mi, a viverra erat commodo sit amet. Duis id tellus vitae.</p>
		<p>Suspendisse in egestas lectus. In et turpis lacus. Nulla finibus lorem dignissim felis malesuada efficitur. Interdum et malesuada fames ac.</p>
		<p><a href="#">Learn more</a></p>
	</section>
	<section data-background="https://picsum.photos/id/1019/1920/1080">
		<h1>Consectetur adipiscing elit</h1>
		<p>Donec consequat scelerisque enim sed sodales. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur rutrum leo iaculis, vehicula dui.</p>
		<p>Nulla orci mauris, varius molestie sapien sit amet, tristique pharetra purus. Cras id vestibulum elit. Duis non nibh gravida, porttitor.</p>
		<p><a href="#">Learn more</a></p>
	</section>
	<section data-background="https://picsum.photos/id/1004/1920/1080">
		<h1>Nessun dorma</h1>
		<p>Nulla nec aliquet ante. Vivamus id faucibus ante, sit amet placerat dui. Aenean hendrerit lorem eu enim vehicula consequat. Quisque.</p>
		<p>Praesent ut urna at mauris semper eleifend nec eu orci. Duis vitae enim viverra purus finibus ornare. Sed mauris elit.</p>
		<p><a href="#">Learn more</a></p>
	</section>
</div>
              
            
!

CSS

              
                .cover() {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
}

body, html {
	width: 100%;
	height: 100%;
}

body {
	font: 400 18px/1.618 'Muli', sans-serif;
	color: #fff;
}

h1 {
	font-weight: 900;
	font-size: 3em;
	line-height: 1.3;
	text-transform: uppercase;
}

a {
	text-decoration: none;
	display: inline-block;
	line-height: 1;
	padding: .8em 1em;
	background: #fff;
	color: #3f5490;
	border-radius: 2px;
}

h1, p {
	margin-top: 1em;
	&:first-child {
		margin-top: 0;
	}
}

.ken-burns {
	width: 100%;
	height: 100%;
	position: relative;
	overflow: hidden;
	section {
		position: absolute;
		text-align: center;
		width: 30%;
		top: 30%;
		left: 35%;
	}
	.background {
		.cover();
		z-index: -1;
		img {
			.cover();
			object-fit: cover;
		}
	}
}
              
            
!

JS

              
                HTMLElement.prototype.makeBurns = makeBurns;
for(slider of document.getElementsByClassName('ken-burns')) {
	slider.makeBurns();
}

function makeBurns() {
	
	// Initialize
	let sections = this.getElementsByTagName('section'),
			background = document.createElement('div');
	
	// Create background div
	for(section of sections) {
		let img = document.createElement('img');
		img.setAttribute('src', section.dataset.background);
		background.appendChild(img);
		TweenLite.set(section, { perspective: 600 });
	}
	
	background.setAttribute('class', 'background');
	this.appendChild(background);
	
	let backgroundImages = background.getElementsByTagName('img');
	
	// Burns timeline
	const burnsDuration = 15,
				displacement = '25%';
	
	new TimelineMax({
		repeat: -1
	})
		.set(background, { transformOrigin: 'right' })
		.to(background, burnsDuration, {
			scale: 1.25,
			ease: Linear.easeNone
		})
		.to(background, burnsDuration, {
			x: '25%',
			ease: Linear.easeNone
		})
		.set(background, { x: '0%', transformOrigin: 'left' })
		.to(background, burnsDuration, {
			scale: 1,
			ease: Linear.easeNone
		})
	
	// Slider
	const transitionTime = 2,
				timeout = 5,
				translationAmount = 150;
	
	let current = 0;
	
	for(var i = 0; i < backgroundImages.length; i++) {
		let alpha = i == current ? 1 : 0,
				z = i == current ? 0 : translationAmount,
				filter = i == current ? 'blur(0)' : 'blur(4px)';
		TweenLite.set(backgroundImages[i], { autoAlpha: alpha });
		TweenLite.set(sections[i].children, { autoAlpha: alpha, z: z, filter: filter });
	}
	
	function goTo(index) {
		
		if(index == current) return false;
		
		new TimelineLite({
			onComplete: autoPlay
		})
			.to(backgroundImages[current], transitionTime, {
				autoAlpha: 0,
				ease: Linear.easeNone
			})
			.to(backgroundImages[index], transitionTime, {
				autoAlpha: 1,
				ease: Linear.easeNone
			}, 0)
			.staggerTo(sections[current].children, transitionTime, {
				autoAlpha: 0,
				z: translationAmount,
				filter: 'blur(4px)',
				autoRound: false,
				ease: Power2.easeIn
			}, transitionTime / 10, 0)
			.staggerTo(sections[index].children, transitionTime, {
				autoAlpha: 1,
				z: 0,
				filter: 'blur(0)',
				autoRound: false,
				ease: Back.easeOut
			}, transitionTime / 10)
			
		
		current = index;
		
	}
	
	function autoPlay() {
		let nextIndex = current + 1 > backgroundImages.length - 1 ? 0 : current + 1;
		TweenLite.delayedCall(timeout, goTo, [nextIndex]);
	}
	
	autoPlay();
	
}

              
            
!
999px

Console