WeiChiaChang/easter-egg-collection

I also want to do one

Opened this issue · 2 comments

How these effects are achieved

Just use js ?

Hello @FourEyebrowXiake, thank you for your interest in easter-egg-collection. All of the easter eggs trigger by typing related keywords, and the GIF image will generate dynamically through new Image(). Just take Ghost this easter egg for example, and the following code is the keypoint :

var record = function(e) {
    if ( e.which === key[ck] ) {
      ck++;
    } else {
      ck = 0;
    }
    if ( ck >= max ) {
      ghost();
      ck = 0;
    }
  };

When the typing words by user match to the keyword (''ghost"), the ghost() function will be triggered.

Last but not least, you can even build your own library with vanilla JavaScript code in the same way. 😄

Btw, easter-eggs-mobile also a collection which includes lots of easter eggs but much more focus on mobile device.

Now know vanilla-js is javascript 🤣