Konami Code Easter Egg
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 - 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');
}
Developer | Teo Litto |
Username | teolitto |
Uploaded | August 26, 2022 |
Rating | 3 |
Size | 3,051 Kb |
Views | 34,408 |
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!
Name | Size |
Liquid Loader | 2,009 Kb |
Depth First Search Connectivity Test | 3,775 Kb |
Networked Paint with Patrick | 4,451 Kb |
Powers Sniffer | 2,663 Kb |
Kitten Sniffer | 2,892 Kb |
Parallaxadise - Quick n dirty scrollytelling demo | 8,928 Kb |
Lock Picking in the DOM | 5,847 Kb |
Starfall | 3,863 Kb |
Dreamforce.com 2017 | 11,454 Kb |
Color morphing | 3,764 Kb |
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!
Name | Username | Size |
Bloomberg Style Link Hover | Gil-- | 1,609 Kb |
This in constructor context | _shree33 | 1,718 Kb |
CSS Heart Loaders | Nourabusoud | 2,161 Kb |
Video Player Custom Controls | EleftheriaBatsou | 3,665 Kb |
Sample Profile Screen | OurDailyBread | 5,375 Kb |
Ripples in water | Nobitagit | 2,704 Kb |
Tree growth tests | Orchard | 3,818 Kb |
Prototype Responsive Homepage | Heyitsolivia | 7,677 Kb |
Bubble animation | Ftabor | 6,565 Kb |
The Monty Hall Problem | Melatonind | 4,360 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!