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

              
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 155 45" class="svg-hidden">
  <defs>
    <g id="bunTop">
      <path class="burg-main burg-bun" d="M77.5,2c-31.82,0-59,10.93-70,22.32A18.26,18.26,0,0,0,2.5,37h0a5,5,0,0,0,5,5h140a5,5,0,0,0,5-5h0a18.26,18.26,0,0,0-5-12.68C136.51,12.93,109.32,2,77.5,2Z"/>
      <g>
        <line class="burg-deets" x1="46.56" y1="10.85" x2="44.44" y2="12.97"/>
        <line class="burg-deets" x1="66.56" y1="10.85" x2="64.44" y2="12.97"/>
        <line class="burg-deets" x1="86.56" y1="10.85" x2="84.44" y2="12.97"/>
        <line class="burg-deets" x1="106.56" y1="10.85" x2="104.44" y2="12.97"/>
        <line class="burg-deets" x1="58.56" y1="19.41" x2="56.44" y2="17.29"/>
        <line class="burg-deets" x1="38.56" y1="19.41" x2="36.44" y2="17.29"/>
        <line class="burg-deets" x1="78.56" y1="19.41" x2="76.44" y2="17.29"/>
        <line class="burg-deets" x1="98.56" y1="19.41" x2="96.44" y2="17.29"/>
        <line class="burg-deets" x1="118.56" y1="19.41" x2="116.44" y2="17.29"/>
      </g>
    </g>
    <path id="bunBottom" class="burg-main burg-bun" d="M7.5,2h140a5,5,0,0,1,5,5v5a10,10,0,0,1-10,10H12.5a10,10,0,0,1-10-10V7a5,5,0,0,1,5-5Z"/>
    <rect id="patty" class="burg-topping burg-topping-brown" x="2.5" y="2" width="150" height="25" rx="12.5" ry="12.5"/>
    <path id="mustard" class="burg-topping burg-topping-yellow" d="M142.5,2H12.5a5,5,0,0,0,0,10h6.56V26.11a2.5,2.5,0,0,0,5,0V12h5.06a4,4,0,0,0-.06.61v7a4,4,0,1,0,8,0v-7A4,4,0,0,0,37,12H142.5a5,5,0,0,0,0-10Z"/>
    <path id="ketchup" class="burg-topping burg-topping-red" d="M142.5,2H12.5a5,5,0,0,0,0,10H76.12a4,4,0,0,0-.06.61v7a4,4,0,0,0,8,0v-7A4,4,0,0,0,84,12h5.06v4.11a2.5,2.5,0,0,0,5,0V12H142.5a5,5,0,0,0,0-10Z"/>
    <rect id="tomato" class="burg-topping burg-topping-red" x="5" y="2" width="145" height="10" rx="5" ry="5"/>
    <path id="cheese" class="burg-topping burg-topping-yellow" d="M141.64,2H12.83A5.33,5.33,0,0,0,7.5,7.33h0a5.33,5.33,0,0,0,4.62,5.29l95.55,12.81a5.86,5.86,0,0,0,2.74-.28L143.6,13.38a5.86,5.86,0,0,0,3.9-5.52h0A5.86,5.86,0,0,0,141.64,2Z"/>
    <path id="lettuce" class="burg-topping burg-topping-green" d="M117.5,26a15.64,15.64,0,0,1-14.71-10.32,5.64,5.64,0,0,0-10.58,0,15.64,15.64,0,0,1-29.41,0,5.64,5.64,0,0,0-10.58,0,15.64,15.64,0,0,1-29.42,0,5.64,5.64,0,0,0-10.58,0,5,5,0,0,1-9.42-3.37,15.64,15.64,0,0,1,29.42,0,5.64,5.64,0,0,0,10.58,0,15.64,15.64,0,0,1,29.42,0,5.64,5.64,0,0,0,10.58,0,15.64,15.64,0,0,1,29.41,0,5.64,5.64,0,0,0,10.58,0,15.64,15.64,0,0,1,29.42,0,5,5,0,0,1-9.41,3.37,5.64,5.64,0,0,0-10.59,0A15.63,15.63,0,0,1,117.5,26Z"/>
  </defs>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 205 155" class="svg-hidden">
	<defs>
		<path id="boxBottom" class="burg-box burg-main" d="M9.64,72.67H194.36a5.17,5.17,0,0,1,5,6.54l-15.88,58.72a19.85,19.85,0,0,1-19.12,14.73H39.68a19.85,19.85,0,0,1-19.12-14.73L4.68,79.22A5.17,5.17,0,0,1,9.64,72.67Z"/>
		<path id="boxTop" class="burg-box burg-main" d="M196.73,82H7.27a5.2,5.2,0,0,1-5.08-6.54L18.47,16.73A20.28,20.28,0,0,1,38.08,2H165.92a20.28,20.28,0,0,1,19.61,14.73l16.29,58.72A5.2,5.2,0,0,1,196.73,82Z"/>
	</defs>
</svg>

<div id="app">
	<div class="wrapper" :class="{'burg-completed': complete}">
		<transition name="squish-width">
			<div v-if="!complete" class="container container-controls">
				<label v-for="(topping, index) in toppings" class="input-checkbox">
					<input 
						type="checkbox"
						class="checkbox-control"
						:value="topping"
						v-model="checked"/>
					<span class="checkbox-label">
						{{ topping.name }}
					</span>
				</label>
			</div>
		</transition>
		<div class="container container-burg">
			<div class="burg">
				<div class="burg-bun-container">
					<svg class="burg-topping-img" viewBox="0 0 155 45">
						<use xlink:href="#bunTop"/>
					</svg>
				</div>
				<transition-group 
					tag="div"
					:css="false"
					v-on:before-enter="bounceStart"
					v-on:enter="bounceEnter"
					v-on:leave="bounceLeave">
					<div v-for="(item,key) in checked" :key="item" :id="'topping'+item.name" class="burg-topping-container" :data-height="item.height">
						<svg :id="'svg'+item.name" class="burg-topping-img" viewBox="0 0 155 45">
							<use :xlink:href="'#' + item.name | lowercase" class="topping"/>
						</svg>
					</div>
				</transition-group>
				<div class="burg-bun-container">
					<svg class="burg-topping-img" viewBox="0 0 155 45">
						<use xlink:href="#bunBottom"/>
					</svg>
				</div>
			</div>
			<transition name="fade-up">
				<svg v-if="complete" id="svgBoxBottom" class="burg-box-img" viewBox="0 70 205 90">
					<use xlink:href="#boxBottom"/>
				</svg>
			</transition>
			<transition name="fade-down">
				<svg v-if="complete" id="svgBoxTop" class="burg-box-img" viewBox="0 0 205 90">
					<use xlink:href="#boxTop"/>
				</svg>
			</transition>
			<transition name="drop-down">
				<svg v-if="complete" id="svgPop" class="pop-img" viewBox="0 -100 115 325">
					<g id="pop">
						<path class="pop pop-straw" d="M89.55,9h-36a2,2,0,0,0-2,2V87a2,2,0,0,0,2,2h6a2,2,0,0,0,2-2V21a2,2,0,0,1,2-2h26a2,2,0,0,0,2-2V11A2,2,0,0,0,89.55,9Z"/>
						<path class="pop pop-cup" d="M96.85,222.39H16.44a5.13,5.13,0,0,1-5.12-4.79L2,57.86a5.13,5.13,0,0,1,5.12-5.47h99a5.13,5.13,0,0,1,5.12,5.47L102,217.6A5.13,5.13,0,0,1,96.85,222.39Z"/>
					</g>
				</svg>
			</transition>
			<transition name="drop-down">
				<svg v-if="complete" id="svgFries" class="fries-img" viewBox="0 -100 117 250">
					<g id="fries">
						<g>
							<rect id="fry1" class="fries fries-fry" x="50.49" y="9" width="15" height="45" rx="2" ry="2"/>
							<rect id="fry2" class="fries fries-fry" x="65.49" y="12.68" width="15" height="45" rx="2" ry="2"/>
							<rect id="fry3" class="fries fries-fry" x="12.28" y="26.44" width="15" height="45" rx="2" ry="2"/>
							<rect id="fry4" class="fries fries-fry" x="25.32" y="20.65" width="15" height="45" rx="2" ry="2"/>
							<rect id="fry5" class="fries fries-fry" x="40.83" y="26.44" width="15" height="45" rx="2" ry="2"/>
							<rect id="fry6" class="fries fries-fry" x="54.99" y="31.5" width="15" height="45" rx="2" ry="2"/>
							<rect id="fry7" class="fries fries-fry" x="74.29" y="26.44" width="15" height="45" rx="2" ry="2"/>
							<rect id="fry8" class="fries fries-fry" x="89.29" y="20.65" width="15" height="45" rx="2" ry="2"/>
						</g>
						<path class="fries fries-container" d="M103.71,147H11.94A10,10,0,0,1,2,137.92L3.32,52.45a5,5,0,0,1,5-5.45h99.06a5,5,0,0,1,5,5.45l1.32,85.47A10,10,0,0,1,103.71,147Z"/>
					</g>
				</svg>
			</transition>
		</div>
	</div>
	<transition name="fade-squish">
		<button v-if="!complete" @click="completeOrder" class="button button-large button-block">Order!</button>
	</transition>
	
	<transition name="fade">
		<button v-if="complete" class="button-reset" @click="complete = false">Go back</button>
	</transition>
</div>
              
            
!

CSS

              
                @import 'https://fonts.googleapis.com/css?family=Work+Sans:300,400,700';
$black: #222;
$white: #fff;
$grey: #999;
$yellow-peach: #f6deac;
$burly-wood: #debd8b;
$carnation: #f6626a;
$asparagus: #83b473;
$kabul: #624a39;

$primary-color: $yellow-peach;
$primary-color-dark: darken( $primary-color, 10% );
$primary-color-tint: lighten( $primary-color, 10% );
$primary-font: "Work Sans", sans-serif;

* { box-sizing: border-box; }
body {
	display: flex;
	justify-content: center;
	background-color: $primary-color;
	font-family: $primary-font;
	font-size: 16px;
	line-height: 1.875em;
	font-weight: 300;
}
.wrapper {
	display: flex;
	margin-top: 50px;
	width: 100%;
	min-width: 500px;
	max-width: 600px;
}
.container {
	flex: 1 0 50%;
	padding: 30px 0;
	// min-width: 200px;
	max-width: 500px;
	min-height: 280px;
	background-color: $white;
	
	&-controls {
		overflow: hidden;	
	}
	
	&-burg {
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
		background-color: $primary-color-tint;
	}
}

.input-checkbox {
	.checkbox-label {
		position: relative;
		display: block;
		padding: 0.1875em 2.375em;
		color: $grey;
		cursor: pointer;
		transition: 0.25s;
		
		&::before {
			content: '+';
			position: absolute;
			left: 2.625em;
			transform: translateX(-10px);
			font-weight: 700;
			font-size: 0.75em;
			opacity: 0;
			transition: 0.35s;
		}
	}
	.checkbox-control {
		position: absolute;
		opacity: 0;
		
		&:checked {
			&:hover {
				+ .checkbox-label {
					&::before {
						content: '-';
					}
				}
			}
			
			+ .checkbox-label {
				color: $black;
				font-weight: 400;
			}
		}
		
		&:hover,
		&:checked {
			+ .checkbox-label {
				padding-left: 3.375em;
				
				&::before {
					transform: translateX(0);
					opacity: 1;
				}
			}
		}
	}
}

.button {
	transform-origin: top center;
	padding: 0.75em 1.25em;
	border: none;
	background-color: $kabul;
	color: $white;
	font-family: $primary-font;
	font-weight: 400;
	font-size: 1rem;
	line-height: 1em;
	text-align: center;
	cursor: pointer;
	transition: 0.25s;
	
	&:hover {
		background-color: lighten($kabul, 10%)
	}
	
	&-large {
		font-size: 1.25rem;
	}
	
	&-block {
		width: 100%;
	}
	
	&-reset {
		border: none;
		background-color: transparent;
		color: $white;
		font-family: $primary-font;
		font-weight: 400;
		font-size: 0.75rem;
		cursor: pointer;
	}
}
 
.burg-deets,
.burg-bun, 
.burg-topping,
.burg-box,
.pop,
.fries {
	stroke: $kabul;
	stroke-miterlimit: 10;
	fill: none;
}

.burg-deets {
	stroke-linecap: round;
	stroke-width: 1px;
}

.burg-bun,
.burg-box,
.pop-cup,
.fries-container {
	stroke-width: 4px;
}

.pop-straw,
.fries-fry{
	stroke-width: 2px;
}

.burg-topping {
	stroke-width: 2px;
	
	&-red {
		fill: $carnation;
	}
	&-yellow {
		fill: $yellow-peach;
	}
	&-green {
		fill: $asparagus;
	}
	&-brown {
		fill: $kabul;
	}
}

.burg-topping-container {
	position: relative;
	height: 25px;
	transform-origin: center;
	overflow: visible;
	
	@for $i from 1 through 6 {
		&:nth-child(#{$i}) { z-index: 6 - $i }
	}
}

#toppingLettuce {
	z-index: 10;
}

.burg-topping-img {
	width: 100%;
	height: 45px;
	overflow: visible;
}

#svgLettuce {
	position: relative;
	top: -3px;
}

.burg-bun-container {
	height: 40px;
}

.burg-box,
.fries-fry {
	fill: $yellow-peach
}

.pop-straw {
	fill: $white;
}

.pop-cup,
.fries-container {
	fill: $carnation;
}

.burg-box-img {
	position: absolute;
	z-index: 20;
	width: 100%;
	height: 80px;
}

#svgBoxTop {
	bottom: calc(50% - 15px);
	transform-origin: top center;
}
#svgBoxBottom {
	top: 50%;
	transform-origin: bottom center;
}

.pop-img {
	position: absolute;
	z-index: 19;
	left: 20%;
	bottom: calc(50% - 50px);
	height: 320px;
	transform-origin: bottom center;
}

.fries-img {
	position: absolute;
	right: 15%;
	bottom: calc(50% - 50px);
	height: 250px;
	transform-origin: bottom center;
}

.burg-completed {
	.burg {
		transform: scaleY(0.7);
		transition: 0.25s 1s;
	}
}

.fade-squish {
	&-enter-active,
	&-leave-active {
		transition-duration: 0.3s ease-in-out;
	}
	&-enter,
	&-leave-to {
		transform: scaleY(0);
		opacity: 0;
	}
}

.squish-width {
	&-enter-active,
	&-leave-active {
		transition: 0.45s ease-in-out;
		transition-delay: 0.35s;
	}
	&-enter,
	&-leave-to {
		max-width: 0;
	}
}

.fade {
	&-enter-active {
		transition: 0.35s 1s;
	}
	&-leave-active {
		transition: 0.2s;
	}
	&-enter,
	&-leave-to {
		opacity: 0;
	}
}

.fade-up {
	&-enter-active,
	&-leave-active {
		transition: 0.4s ease-in-out;
		transition-delay: 0.9s;
	}
	&-enter,
	&-leave-to {
		transform: scaleY(0.3) translateY(50px);
		opacity: 0;
	}
}

.fade-down {
	&-enter-active,
	&-leave-active {
		transition: 0.4s ease-in-out;
		transition-delay: 0.9s;
	}
	&-enter,
	&-leave-to {
		transform: scaleY(0.3) translateY(-50px);
		opacity: 0;
	}
}

.drop-down {
	&-enter-active {
		transition: 0.45s 1.2s ease-in-out;
		animation-duration: 0.25s;
		animation-delay: 1.5s;
		animation-name: bounce;
		
		.pop-straw {
			transition: 0.3s 2.7s ease-in-out;
		}
		
		.fries-fry {
			transition: 0.25s ease-in-out;
		}
		
		@for $i from 1 to 9 {
			#fry#{$i} {
				transition-delay: 1.9 + ($i * .075) + s;
			}
		}
	}
	&-leave-active {
		transition: 0.25s ease-in-out;
	}
	&-enter {
		.pop-straw,
		.fries-fry {
			transform: translateY(-300px);
		}
	}
	&-enter,
	&-leave-to {
		transform: translateY(-200%);
	}
}

.pop-straw,
.fries-fry {
	transition: 0.25s;
}

.svg-hidden {
	position: absolute;
	height: 0;
	width: 0;
}

@keyframes bounce {
  0%, 100% {
    transform: scale(1)
  }
  20% {
    transform: scaleY(0.5)
  }
  35% {
    transform: scaleY(1.1)
  }
  55% {
    transform: scaleY(0.7)
  }
  80% {
    transform: scaleY(1.05)
  }
}
              
            
!

JS

              
                console.clear();

const app = new Vue({
	el: '#app',
	data: {
		complete: false,
		toppings: [
			{ 
				name: 'Patty',
				height: 25
			},
			{ 
				name: 'Mustard',
				height: 10
			},
			{ 
				name: 'Ketchup',
				height: 10
			},
			{ 
				name: 'Tomato',
				height: 10
			},
			{ 
				name: 'Cheese',
				height: 10
			},
			{ 
				name: 'Lettuce',
				height: 15
			}
		],
		checked: [
			{ 
				name: 'Patty',
				height: 25
			}
		]
	},
	// computed: {
	// 	reverseChecked() {
	// 		// let copy = [...this.checked];
	// 		this.checked.splice(0, 0, this.checked.pop());
	// 		return this.checked;
	// 	}
	// },
	filters: {
		lowercase: function(value) {
			return value.toLowerCase();
		}
	},
	methods: {
		bounceStart(el) {
			el.style.transform = 'scaleY(0)';
			el.style.height = '0';
		},
		bounceEnter(el, done) {
			let bounce = anime.timeline({
				complete: function() {
					done();
				}
			});
			let height = el.getAttribute('data-height');
			bounce
				.add({
					targets: el,
					height: parseInt(height)  + 20,
					duration: 800,
					// easing: 'linear',
					elasticity: 100
				})
				.add({
					targets: el,
					scaleY: 1,
					delay: 100
				})
				.add({
					targets: el,
					height: height,
					duration: 600,
					elasticity: 100
				});
		},
		bounceLeave(el, done) {
			let bounce = anime.timeline({
				complete: function() {
					done();
				}
			});
			bounce
				.add({
					targets: el,
					// scaleY: 0,
					translateY: 10,
					opacity: 0,
					height: 0,
					duration: 300,
					easing: 'linear',
					elasticity: 100
				})
				// .add({
				// 	targets: el,
				// 	height: 0,
				// 	easing: 'linear',
				// 	elasticity: 0
				// });
		},
		completeOrder() {
			this.complete = true;
		}
	}
});
              
            
!
999px

Console