A fun little project that listens for a specific sequence of keystrokes on your keyboard and triggers an Easter egg when the sequence is matched. This project uses JavaScript to detect a secret code and then runs a quirky animation using the Cornify library.
Type asad
on your keyboard while the page is open, and enjoy the surprise! π
Key-Sequence-Detection/
β
βββ index.html # Main HTML file containing the script
βββ cornify.js # External script for adding fun effects (unicorns, rainbows, etc.)
βββ README.md # Project documentation
- Listens to key presses (
keyup
events) - Detects a custom secret code (
asad
) - Triggers a visual effect using
cornify_add()
from the Cornify library - Logs pressed keys to the console for debugging
- Each key press is stored in the
pressed
array. - The array maintains only the last N keys, where N is the length of the
secretCode
. - When the sequence of keys matches the secret code, an animation is triggered.
Just a browser! No frameworks or external dependencies (other than cornify.js
).
Want to change the secret code? Modify this line in the script:
const secretCode = 'your-secret-code';
You can also replace or customize the effect inside the if
condition.
- Cornify for the magical visual effects β¨
- Inspired by Wes Bos' JavaScript 30 series
MIT License