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

              
                .main-content
	.map-base
		.footsteps.footsteps-1
			.footstep.left
			.footstep.right
			.scroll-name 
				p Severus Snape
		.footsteps.footsteps-2
			.footstep.left
			.footstep.right
			.scroll-name 
				p Harry Potter
		.map-flap.flap--1
			.map-flap__front
			.map-flap__back
		.map-flap.flap--2
			.map-flap__front
			.map-flap__back
		.map-side.side-1
			.front(style="--image: url('https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/8.png')")
			.back
		.map-side.side-2
			.front(style="--image: url('https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/18.png')")
			.back
		.map-side.side-3
			.front(style="--image: url('https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/7.png')")
			.back
		.map-side.side-4
			.front(style="--image: url('https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/10.png')")
		.map-side.side-5
			.front(style="--image: url('https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/6.png')")
			.back
		.map-side.side-6
			.front(style="--image: url('https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/11.png')")
			.back
			
.instructions
	p 1. Enable Codepen to use your microphone.
	p 2. Map will open if you say "I solemnly swear that I'm up to no good."
	p 3. Map will close if you say "Mischief Managed!".
	p 4. Remember to speak clearly.
	br
	p This looks a lot better zoomed out (sorry).
	br
	p If you do not want to use a microphone, press this button!
	button.toggle-map.js-toggle Open/Close Map

aside.context
	.explanation
		| Part of the 
		a(href="https://codepen.io/collection/XJNKLz/" target="_blank") CSS Animations
		|  and 
		a(href="https://codepen.io/collection/DjwqvK/" target="_blank") Harry Potter
		|  collections.

footer
	a(href="https://twitter.com/meowlivia_" target="_blank")
		i.icon-social-twitter.icons
	a(href="https://github.com/oliviale" target="_blank")
		i.icon-social-github.icons
	a(href="https://dribbble.com/oliviale" target="_blank")
		i.icon-social-dribbble.icons
              
            
!

CSS

              
                $brown: #615349;

body {
	background: #222;
	font-family: "Comfortaa", sans-serif;
}

aside.context {
	text-align: center;
	color: #fff;
	line-height: 1.7;
	a {
		text-decoration: none;
		color: #fff;
		padding: 3px 0;
		border-bottom: 1px dashed;
		&:hover {
			border-bottom: 1px solid;
		}
	}
	.explanation {
		max-width: 700px;
		margin: 6em auto 0;
	}
}

footer {
	text-align: center;
	margin: 4em auto;
	width: 100%;
	a {
		text-decoration: none;
		display: inline-block;
		width: 45px;
		height: 45px;
		border-radius: 50%;
		background: transparent;
		border: 1px dashed #fff;
		color: #fff;
		margin: 5px;
		&:hover {
			background: rgba(255, 255, 255, 0.1);
		}
		.icons {
			margin-top: 12px;
			display: inline-block;
			font-size: 20px;
		}
	}
}

.main-content {
	text-align: center;
	margin: 8em auto;
}

.map-base {
	width: 306px;
	height: 600px;
	margin: auto;
	background: url("https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/9.png") center center / cover;
	position: relative;
	display: inline-block;
}

.map-flap {
	transform-style: preserve-3d;
	position: absolute;
	width: 100%;
	height: 25%;
	margin: auto;
	left: 0;
	right: 0;
	transition: 0.5s ease;
	top: 25%;
	&__front,
	&__back {
		backface-visibility: hidden;
		width: 100%;
		height: 100%;
		position: absolute;
	}
	&__back {
		transform: scale(-1) rotateY(180deg);
	}
	&.flap--1 {
		box-shadow: 0 -1px 6px rgba($brown, 0.5);
		.map-flap__front {
			background: url("https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/mini-1.png") center left /
				cover;
		}
		.map-flap__back {
			background: url("https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/mini-3.png") -3px 0/ cover;
		}
	}
	&.flap--2 {
		box-shadow: 0 1px 6px rgba($brown, 0.5);
		top: 50%;
		.map-flap__front {
			background: url("https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/mini-2.png") center left /
				cover;
		}
		.map-flap__back {
			background: url("https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/mini-4.png") -3px 0/ cover;
		}
	}
}

.map-side {
	height: 600px;
	width: 152px;
	position: absolute;
	transform-style: preserve-3d;
	transition: 0.3s ease;
	.front,
	.back {
		width: 100%;
		height: 100%;
		position: absolute;
		background-repeat: no-repeat;
		background-position: left top;
		background-size: cover;
		background-image: var(--image);
		backface-visibility: hidden;
	}
	.back {
		background-image: url(https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/back.png);
	}
}

.map-side {
	top: 0;
	&.side-1 {
		left: 0;
		margin-left: 1.5px;
	}
	&.side-2 {
		left: 50%;
		margin-left: -2px;
	}
	&.side-3 {
		left: 0;
		margin-left: 3px;
		.back {
			transform: rotateY(180deg);
		}
	}
	&.side-4 {
		left: 50%;
		margin-left: -1px;
		.back {
			transform: rotateY(180deg);
		}
	}
	&.side-5 {
		left: 0;
		.back {
			background-image: url(https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/1.png);
		}
	}
	&.side-6 {
		left: 50%;
		.front {
			background-size: 99.5%;
		}
		.back {
			background-image: url(https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/17.png);
		}
	}
}

.scroll-name {
	position: absolute;
	bottom: 105px;
	left: -60px;
	width: 150px;
  height: 30px;
	font: 15px Satisfy, cursive;
	text-align:center;
	background: url('https://meowlivia.s3.us-east-2.amazonaws.com/codepen/map/scroll.svg') center center / cover;
	z-index: 10;
	color: $brown;
	cursor: default;
	opacity: 0;
	p {
		display: inline-block;
		margin: 4px 0 0 15px;
	}
}

.footstep {
	position: absolute;
	background: $brown;
	width: 6px;
	height: 12px;
	border-radius: 80% 80% 70% 70%/130% 130% 25% 25%;
	z-index: 10;
	opacity: 0;
	&:before {
		content: "";
		position: absolute;
		border-radius: 6px;
		width: 5px;
		height: 5px;
		top: 110%;
		left: 0px;
		background: $brown;
		border-radius: 0 0 100% 100%;
	}
	&.left {
		transform: rotate(5deg);
	}
	&.right {
		transform: rotate(-3deg) translateY(15px) translateX(10px);
	}
}

.footsteps-1 {
	.footstep.left {
		bottom: 150px;
		left: 18px;
		transform: rotate(35deg);
	}
	.footstep.right {
		bottom: 150px;
		left: 28px;
		transform: rotate(30deg);
	}
}

.footsteps-2 {
	.footstep.left {
		bottom: 285px;
		left: 280px;
		transform: rotate(-90deg);
	}
	.footstep.right {
		bottom: 275px;
		left: 285px;
		transform: rotate(-85deg);
	}
	.scroll-name {
		bottom: 300px;
		left: 220px;
	}
}

.instructions {
	text-align: center;
	color: #fff;
	p {
		margin-bottom: 8px;
		line-height: 1.3;
	}
}

.toggle-map {
	border: 2px solid;
	margin: 30px auto 0;
	background: transparent;
	font: 34px "Lobster Two", cursive;
	padding: 8px 30px;
	cursor: pointer;
	position: relative;
	color: #fff;
	&:before {
		content: "";
		position: absolute;
		width: calc(100% - 8px);
		height: 51px;
		left: 2px;
		top: 2px;
		border: 2px solid;
	}
	&:hover {
		&:before {
			width: 100%;
			height: 100%;
			transition: 0.3s ease;
			left: -2px;
			top: -2px;
			right: auto;
		}
	}
	&:focus {
		outline: none;
	}
}

.map-base.active {
	.flap--1 {
		transform: rotateX(180deg);
		transform-origin: top center;
		transition: 0.6s transform 1.5s;
	}
	.flap--2 {
		transform: rotateX(180deg);
		transform-origin: bottom center;
		transition: 0.6s transform 1.8s;
	}
	.side-1 {
		transform-origin: center left;
		transform: rotateY(180deg) skewY(2deg);
		transition: 0.5s all ease-in-out 0.6s;
		.front {
			transform: rotateY(180deg);
		}
	}
	.side-2 {
		transform: rotateY(180deg) skewY(-2deg);
		transform-origin: center right;
		transition: 0.5s all ease-in-out 0.6s;
		.front {
			transform: rotateY(180deg);
		}
	}
	.side-3 {
		left: -50%;
		transform: skewY(2deg) translateX(-100%);
		top: 8px;
		transition: 0.5s transform ease 0.8s, 0.3s left ease 0.8s, 0.5s top ease 0.8s;
	}
	.side-4 {
		left: 100%;
		transform: skewY(-2deg) translateX(100%);
		top: 8px;
		margin-left: -7px;
		transition: 0.5s transform ease 0.8s, 0.3s left ease 0.8s, 0.5s top ease 0.8s,
			0.5s margin ease 0.8s;
	}
	.side-5 {
		left: -100%;
		transform-origin: center left;
		transform: rotateY(180deg);
		transition: 0.5s transform, 0.7s left 0.8s, 0.2s margin 0.8s;
		top: 0px;
		margin-left: 4px;
		.front {
			transform: rotateY(180deg);
			transition: 0.1s transform;
		}
	}
	.side-6 {
		left: 150%;
		transform: rotateY(180deg);
		transform-origin: center right;
		margin-left: -8px;
		transition: 0.5s transform 0.3s, 0.7s left 0.8s, 0.5s top 0.8s,
			0.5s margin 0.8s;
		.front {
			transform: rotateY(180deg);
			transition: 0.1s transform;
		}
	}
	.footstep, .scroll-name {
		opacity: 1;
		transition: .5s opacity 2.5s;
	}
	.footsteps-1 {
		.footstep {		
			animation: 15s footsteps-1 ease 3s forwards;
		}
		.scroll-name {
			animation: 15s scroll-1 ease 3s forwards;
		}
	}
	.footsteps-2 {
		.footstep {
			animation: 15s footsteps-2 ease 3.2s forwards;
		}
		.scroll-name {
			animation: 15s scroll-2 ease 3.2s forwards;
		}
	}
}


@keyframes footsteps-1 {
	10% { transform: translate(8px, -15px) rotate(30deg) }
	20% { transform: translate(30px, -45px) rotate(30deg) }
	30% { transform: translate(40px, -75px) rotate(20deg) }
	40% { transform: translate(45px, -100px) rotate(10deg) }
	50% { transform: translate(50px, -125px) rotate(10deg) }
	60% { transform: translate(50px, -135px) rotate(10deg) }
	100% { transform: translate(50px, -135px) rotate(20deg) }
}

@keyframes footsteps-2 {
	0% { }
	80% { transform: translate(-170px, -25px) rotate(-90deg) }
	100% { transform: translate(-180px, -25px) rotate(-90deg) }
}

@keyframes scroll-1 {
	10% { transform: translate(8px, -15px) }
	20% { transform: translate(30px, -45px) }
	30% { transform: translate(40px, -75px) }
	40% { transform: translate(45px, -100px) }
	50% { transform: translate(50px, -125px) }
	60% { transform: translate(50px, -135px) }
	100% { transform: translate(50px, -135px) }
}

@keyframes scroll-2 {
	0% { }
	80% { transform: translate(-170px, -25px) }
	100% { transform: translate(-180px, -25px) }
}


              
            
!

JS

              
                //toggle button
$('.js-toggle').on('click', function(){
	$('.map-base').toggleClass('active');
});


//initialization of speech recognition starts here
const artyom = new Artyom();
var commands = [
 {
	 indexes:["up to no good"],
	 action:function() {
		 $('.map-base').addClass('active');
	 }
 }, {
	 indexes:["mischief managed"],
	 action:function() {
		 $('.map-base').removeClass('active');
	 }
 }
]

artyom.addCommands(commands);

function startContinuousArtyom(){
    artyom.fatality();

    setTimeout(function(){
         artyom.initialize({
            lang:"en-GB",
            continuous:true,
            listen:true, 
            speed:1
        }).then(function(){
            console.log("Ready to work !");
        });
    },250);
}

startContinuousArtyom();
              
            
!
999px

Console