Konami Code Easter Egg

Developer
Size
3,051 Kb
Views
34,408

How do I make an konami code easter egg?

There's a popular plugin out there that purports to do cool stuff with a dinosaur when you enter the Konami code. I've never seen that plugin work on any computer or any browser ever, so (at client request) I threw together something today that does the trick. Good stuff on how to do "key combos" here.. What is a konami code easter egg? How do you make a konami code easter egg? This script and codes were developed by Teo Litto on 26 August 2022, Friday.

Konami Code Easter Egg Previews

Konami Code Easter Egg - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Konami Code Easter Egg</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="panel"> <ul> <li>↑</li> <li>↑</li> <li>↓</li> <li>↓</li> <li>←</li> <li>→</li> <li>←</li> <li>→</li> <li>B</li> <li>A</li> </ul>
</div>
<div class="dino"> <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/95637/angry-cat-face-masked.png" alt="" />
</div> <audio id="meow"> <source src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/95637/angryCat.mp3" type="audio/mpeg"> <source src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/95637/angryCat.ogg" type="audio/ogg"> </audio> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Konami Code Easter Egg - Script Codes CSS Codes

* { border: 0; margin: 0; outline: 0;
}
body { background: #05060b; overflow: hidden;
}
.panel { text-align: center; display: block; width: 753px; height: 201px; margin: 50px auto; background: -moz-linear-gradient(top, #403f3f 1%, #0e0e0e 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,#403f3f), color-stop(100%,#0e0e0e)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #403f3f 1%,#0e0e0e 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #403f3f 1%,#0e0e0e 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #403f3f 1%,#0e0e0e 100%); /* IE10+ */ background: linear-gradient(to bottom, #403f3f 1%,#0e0e0e 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#403f3f', endColorstr='#0e0e0e',GradientType=0 ); /* IE6-9 */
}
.panel:before { content: ''; display: inline-block; height: 100%; vertical-align: middle;
}
.panel ul { font-family: helvetica, arial, sans-serif; list-style-type: none; margin: 0 auto; padding: 0; text-align: center; width: auto; display: inline-block; vertical-align: middle;
}
.panel ul:after { content: ''; display: block; clear: both;
}
.panel ul li { color: #111; float: left; font-size: 90px; margin-right: 5px; position: relative; text-shadow: 0px -2px 0px rgba(255,255,255,.09);
}
.panel ul li.entered { color: #0f0; text-shadow: 0px 0px 9px rgba(0, 255, 0, 1);
}
.dino { display: block; width: 371px; height: 460px; position: absolute; right: 0px; bottom: -440px; z-index: 9999;
}

Konami Code Easter Egg - Script Codes JS Codes

var codeTimerLength = 500;
var codeTimer;
var codePosition = 0;
var code = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65];
$(function(){ $(document).on('keyup',function(e){ if(e.which == code[codePosition] && !$('.dino').filter(':animated').length) { // console.log('successful keypress at position', codePosition) try { $('.panel ul li').eq(codePosition).addClass('entered'); clearTimeout(codeTimer); if (codePosition < code.length-1) { codePosition++; codeTimer = setTimeout(function(){resetTimer();}, codeTimerLength) } else { triggerEgg(); } } catch(e){} } else if (e.which != code[codePosition]) { resetTimer(); } })
})
function triggerEgg(){ //alert('egg triggered! RAAARR!') $('#meow')[0].currentTime = 0 $('#meow')[0].play(); $('.dino').css({ bottom: -440, right: 0 }); $('.dino').animate({ bottom: 0 },400).promise().done(function(){ $('.dino').animate({ right: '100%' }, 700).promise().done(function(){ $('.dino').css({ bottom: -440, right: 0 }); resetTimer(); }) })
}
function resetTimer(){ console.log('codeTimer reset'); try { clearTimeout(codeTimer); } catch(e){} codeTimer = null; codePosition = 0; $('.panel ul li').removeClass('entered');
}
Konami Code Easter Egg - Script Codes
Konami Code Easter Egg - Script Codes
Home Page Home
Developer Teo Litto
Username teolitto
Uploaded August 26, 2022
Rating 3
Size 3,051 Kb
Views 34,408
Do you need developer help for Konami Code Easter Egg?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Teo Litto (teolitto) Script Codes
Create amazing captions with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!