Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

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.

            
              .main-container
	.img.img-1
	.img.img-2
	.img.img-3
	.img.img-4
	.img.img-5
	.title.title-1 San Francisco
	.title.title-2 Hong Kong
	.title.title-3 London
	.title.title-4 New York
	.title.title-5 Tokyo
	
	.info-container
		h3 CSS gallery powered by #[a(href="http://animista.net" target="_blank") Animista.net]
		h4 Appearing animations
		p #[a(href="http://animista.net/play/background/ken-burns/kenburns-top" target="_blank") kenburns-top], #[a(href="http://animista.net/play/background/ken-burns/kenburns-bottom" target="_blank") kenburns-bottom], #[a(href="http://animista.net/play/background/ken-burns/kenburns-left" target="_blank") kenburns-left], #[a(href="http://animista.net/play/background/ken-burns/kenburns-right" target="_blank") kenburns-right]
		p #[a(href="http://animista.net/play/text/focus-in/focus-in-contract" target="_blank") focus-in-contract]
		p #[a(href="http://animista.net/play/entrances/slide-in/slide-in-bottom" target="_blank") slide-in-bottom]
		
		h4 Disappearing animations
		p #[a(href="http://animista.net/play/exits/fade-out/fade-out" target="_blank") fade-out]
		p #[a(href="http://animista.net/play/text/blur-out/text-blur-out" target="_blank") text-blur-out]
	
	.loader-container
		.loader 
		p Loading images...
		
.preloaded


            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Rubik:300,400,700');

@duration: 6s;
@duration2: 2s;
@delay1: .5s;
@delay2: @duration + @delay1 - 1;
@delay3: @duration + @delay2 - 1;
@delay4: @duration + @delay3 - 1;
@delay5: @duration + @delay4 - 1;
@delay6: @duration + @delay5 - 1;
@delay7: @duration + @delay6 - 3;
	
body {
	background: black;
	color: #fff;
	font-family: 'Rubik', sans-serif;
}

.main-container {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
	background: black;
	overflow: hidden;
	z-index: 1;
	perspective: 400px;
	transition: opacity .3s;
}

.img {
	position: absolute;
	overflow: hidden;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	background-color: transparent;
	background-position: center center;
	background-repeat: no-repeat;
	background-size: cover;
	opacity: 0;
}

.title {
	display: block;
	position: absolute;
	width: 200%;
	top: 50%;
	left: -50%;
	transform: translateY(-50%);
	font-size: 6em;
	text-align: center;
	color: #FFF;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	opacity: 0;
	z-index: 5;
}

.info-container {
	position: absolute;
	left: 20%;
	top: 0;
	right: 20%;
	bottom: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	text-align: center;
	transform: translateY(100%);
	opacity: 0;
	z-index: 5;

	h3 {
		font-size: 2.6em;
		font-weight: 400;
		letter-spacing: .05em;
		margin: 0 0 .5em 0;
		padding: 0;
	}
	
	h4 {
		font-size: 1.7em;
    font-weight: 400;
    margin: 1.4em 0 .8em 0;
    padding: 0;
    text-transform: uppercase;
		letter-spacing: .1em;
	}
	
	h5 {
		font-size: 1.3em;
		font-weight: 300;
		margin: 1.5em 0 .5em 0;
		padding: 0;
    text-transform: uppercase;
	}
	
	p {
		font-size: 1.2em;
		margin: 0;
		padding: 0;
		line-height: 1.6;
	}
	
	a {
		color: #fff;
		text-decoration: none;
		opacity: .6;
		transition: all .3s;
		
		&:hover {
			opacity: 1;
		}
	}
}

.main-container.loaded {
	.loader-container {
		display: none;
	}
	
	.img,
	.info-container {
		opacity: 1;
	}

	.title {
		opacity: 0;
	}
	
	.img-1 {
		background-image: url(https://images.unsplash.com/photo-1501594907352-04cda38ebc29?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=35233ecf7c2f6b1b99123374610926fe);
		animation: kenburns-top @duration linear both reverse @delay1, fade-out @duration2 ease-in forwards @delay2;
		z-index: 5;
	}

	.img-2 {
		background-image: url(https://images.unsplash.com/photo-1507941097613-9f2157b69235?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=f8f33afdfc69b16d51c996cf3a8cc1c7);
		animation: kenburns-bottom @duration linear both @delay2, fade-out @duration2 ease-in forwards @delay3;
		z-index: 4;
	}

	.img-3 {
		background-image: url(https://images.unsplash.com/photo-1506501139174-099022df5260?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=4868d202b74b7a313bb34a3d8526428c);
		animation: kenburns-right @duration linear both reverse @delay3, fade-out @duration2 ease-in forwards @delay4;
		z-index: 3;
	}

	.img-4 {
		background-image: url(https://images.unsplash.com/photo-1480714378408-67cf0d13bc1b?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=d8f8d728cc689063536174ec02129ebc);
		animation: kenburns-left @duration linear both @delay4, fade-out @duration2 ease-in forwards @delay5;
		z-index: 2;
	}

	.img-5 { 
		background-image: url(https://images.unsplash.com/photo-1505814360303-5bfcf2a8acb6?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=86aaa627e11ca46f2177787d563de340);
		animation: kenburns-right @duration + 1 linear both reverse @delay5, fade-out @duration2 + 1 ease-in forwards @delay6 - 1;
		z-index: 1;
	}

	.title-1 {
			animation: focus-in-contract 1.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) forwards @delay1 + 1.3, text-blur-out 1.2s ease-in forwards @delay2;
	}

	.title-2 {
			animation: focus-in-contract 1.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) forwards @delay2 + 1.3, text-blur-out 1.2s ease-in forwards @delay3;
	}

	.title-3 {
				animation: focus-in-contract 1.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) forwards @delay3 + 1.3, text-blur-out 1.2s ease-in forwards @delay4;
		}

	.title-4 {
			animation: focus-in-contract 1.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) forwards @delay4 + 1.3, text-blur-out 1.2s ease-in forwards @delay5;
	}

	.title-5 {
			animation: focus-in-contract 1.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) forwards @delay5 + 1.3, text-blur-out 1.6s ease-in forwards @delay6;
	}
	
	.info-container {
		opacity: 0;
		animation: slide-in-bottom 12s cubic-bezier(0.250, 0.460, 0.450, 0.940) forwards @delay6 + 1;
	}
}

/* ----------------------------------------------
 * Generated by Animista on 2017-12-10 16:42:7
 * w: http://animista.net, t: @cssanimista
 * ---------------------------------------------- */

/**
 * ----------------------------------------
 * animation kenburns-top
 * ----------------------------------------
 */
@keyframes kenburns-top {
  0% {
    transform: scale(1) translateY(0);
    transform-origin: 50% 16%;
  }
  100% {
    transform: scale(1.25) translateY(-15px);
    transform-origin: top;
  }
}

/**
 * ----------------------------------------
 * animation kenburns-bottom
 * ----------------------------------------
 */
@keyframes kenburns-bottom {
  0% {
    transform: scale(1) translateY(0);
    transform-origin: 50% 84%;
  }
  100% {
    transform: scale(1.25) translateY(15px);
    transform-origin: bottom;
  }
}

/**
 * ----------------------------------------
 * animation kenburns-right
 * ----------------------------------------
 */
@keyframes kenburns-right {
  0% {
    transform: scale(1) translate(0, 0);
    transform-origin: 84% 50%;
  }
  100% {
    transform: scale(1.25) translateX(20px);
    transform-origin: right;
  }
}

/**
 * ----------------------------------------
 * animation kenburns-left
 * ----------------------------------------
 */
@keyframes kenburns-left {
  0% {
    transform: scale(1) translate(0, 0);
    transform-origin: 16% 50%;
  }
  100% {
    transform: scale(1.25) translate(-20px, 15px);
    transform-origin: left;
  }
}

/**
 * ----------------------------------------
 * animation focus-in-contract
 * ----------------------------------------
 */
@keyframes focus-in-contract {
  0% {
    letter-spacing: 1em;
    filter: blur(12px);
    opacity: 0;
  }
  100% {
    filter: blur(0px);
    opacity: 1;
  }
}

/**
 * ----------------------------------------
 * animation tracking-in-contract
 * ----------------------------------------
 */
@keyframes tracking-in-contract {
  0% {
    letter-spacing: 1em;
    opacity: 0;
  }
  40% {
    opacity: 0.6;
  }
  100% {
    letter-spacing: normal;
    opacity: 1;
  }
}


/**
 * ----------------------------------------
 * animation fade-out
 * ----------------------------------------
 */
@keyframes fade-out {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/**
 * ----------------------------------------
 * animation fade-in
 * ----------------------------------------
 */
@keyframes fade-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/**
 * ----------------------------------------
 * animation text-blur-out
 * ----------------------------------------
 */
@keyframes text-blur-out {
  0% {
    filter: blur(0.01);
  }
  100% {
    filter: blur(12px) opacity(0%);
  }
}

/**
 * ----------------------------------------
 * animation slide-in-bottom
 * ----------------------------------------
 */
@keyframes slide-in-bottom {
  0% {
    transform: translateY(100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/**
 * ----------------------------------------
 * animation rotate-center
 * ----------------------------------------
 */
@keyframes rotate-center {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}

.preloaded {
	position: absolute;
	bottom: -1px;
	left: -1px;
	width: 1px;
	height: 1px;
	overflow: hidden;
	visibility: hidden;
}

.loader-container {
  position: absolute;
  top: 0;
	bottom: 0;
  left: 0;
	right: 0;
	text-align: center;
	font-size: .9em;
	letter-spacing: .13em;
	text-transform: uppercase;
	font-weight: 400;
	color: #fff;
	background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-content: center;
	z-index: 5;
}

.loader {
  width: 42px;
  height: 42px;
	margin-bottom: 10px;
	align-self: center;
  border-radius: 50%;
  background: whiteSmoke;
  box-shadow: 0px -10px 25px 0px #ffffff inset;
    background: linear-gradient(to right, rgba(255, 255, 255, 1) 50%, transparent 50%);
    opacity: .8;
    animation: rotate-center 0.7s infinite linear;
	
	&:before {
		display: block;
		content: '';
		position: relative;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		width: 39px;
		height: 39px;
		border-radius: 50%;
		background: black;
	}
}
            
          
!
            
              var preloaded = document.querySelector('.preloaded');
var queue = new createjs.LoadQueue(true,null,true);

queue.on('fileload', handleLoad, this);

queue.on('progress', handleProgress, this);

queue.on('complete', handleComplete, this);

queue.loadManifest([
	{
		id: 'sf',
		crossOrigin: true,
		type: createjs.Types.IMAGE,
		src: 'https://images.unsplash.com/photo-1501594907352-04cda38ebc29?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=35233ecf7c2f6b1b99123374610926fe'
	},
	{
		id: 'hk',
		crossOrigin: true,
		type: createjs.Types.IMAGE,
		src: 'https://images.unsplash.com/photo-1507941097613-9f2157b69235?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=f8f33afdfc69b16d51c996cf3a8cc1c7'
	},
	{
		id: 'lon',
		crossOrigin: true,
		type: createjs.Types.IMAGE,
		src: 'https://images.unsplash.com/photo-1506501139174-099022df5260?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=4868d202b74b7a313bb34a3d8526428c'
	},
	{
		id: 'nyc',
		crossOrigin: true,
		type: createjs.Types.IMAGE,
		src: 'https://images.unsplash.com/photo-1480714378408-67cf0d13bc1b?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=d8f8d728cc689063536174ec02129ebc'
	},
	{
		id: 'tok',
		crossOrigin: true,
		type: createjs.Types.IMAGE,
		src: 'https://images.unsplash.com/photo-1505814360303-5bfcf2a8acb6?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&s=86aaa627e11ca46f2177787d563de340'
	}
]);

function handleProgress(event) {
	console.log(event.progress);
}

function handleLoad(event) {
	// console.log(event);
	var img = new Image();
	// img.crossOrigin = 'Anonymous';
	img.src = event.item.src;
	preloaded.appendChild(img);
	// var img = queue.getResult('image',true);
	// preloaded.appendChild(event.result);
}

function handleComplete() {	
	document.querySelector('.main-container').classList.add('loaded');
	console.log('done');
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console