emoji-blast

HomeDemoDocs

emoji-blast

🎆 Blasts emoji like fireworks all up in your HTML page. 🎇

GitHub

Usage

"Now" Mode

Plop this 👇 at the end of your .html <body>:

<script async src="https://unpkg.com/emoji-blast/dist/now.js"></script>

That ☝ loads emoji-blast soon after your page loads and starts emojiBlasts() as soon as it can.

Alternately, to create global emojiBlast and emojiBlasts functions:

<script src="https://unpkg.com/emoji-blast/dist/global.js"></script> <script> // Just one explosion, please. emojiBlast(); // Commence explosions! emojiBlasts(); </script>

emojiBlast launches a single blast of emojis at random locations on the page.

emojiBlasts starts calling emojiBlast on a random interval of every few seconds.


Explanation:

Each emojiBlast causes a fireworks-like explosion of random emojis to be placed around a random location on your page. Each explosion contains around a dozen emojis, each of which are animated in JavaScript to:

  • Start with a random horizontal velocity and random upward vertical velocity
  • Move along the page as if affected by velocity and preserving inertia

After an emoji is completely hidden or out of bounds, it is removed from the page.

Advanced Mode

With ESbuild, Vite, Webpack, and other modern JavaScript bundlers:

import { emojiBlast, emojiBlasts } from "emoji-blast"; // Just one explosion, please. emojiBlast(); // Commence explosions! emojiBlasts();

Oh, and emoji-blast is written in TypeScript and ships with its own typings. 💣


To learn how to further configure emoji-blast read the docs or look at the demos to see the package in action!