A beautiful, animated birthday greeting page built with Vanilla JavaScript and GSAP. Fully customizable through a single config file β no coding skills required!
- π¬ Smooth GSAP animations (typing effect, floating balloons, confetti, fireworks, and more)
- π§© Modular component system β add, remove, or reorder sections by editing one file
- π Dark / Light mode toggle
- π± Responsive and mobile-friendly
- π΅ Optional background music
- β‘ No build step, no framework, no server required
- Download or clone this repository
- Edit
config.jsto customize the name, photo, message, and sections - Right-click
index.htmlβ Open with Live Server (VS Code) or simply open it in your browser
Tip: If you use VS Code, install the Live Server extension. Then right-click
index.htmland select "Open with Live Server". That's it!
Everything is controlled from one file: config.js.
name: "Irene", // Recipient's name
photo: "./img/irene.jpg", // Photo in the img/ folder
music: "./music/hbd.mpeg", // Music in the music/ folderdefaultMode: "dark", // "dark" or "light"
colors: {
primary: "#f472b6", // Main accent (name, highlights)
accent: "#60a5fa", // Secondary accent (buttons)
dark: { background: "#0f172a", text: "#f1f5f9" },
light: { background: "#fafaf9", text: "#1e293b" },
},The viewer can also toggle between dark and light mode using the βοΈ/π button.
Sections are listed in an array. The display order matches the array order.
Remove a section β delete the object:
sections: [
{ type: "greeting", title: "Hi", subtitle: "..." },
// { type: "announcement", text: "..." }, β removed
{ type: "chatbox", message: "..." },
]Duplicate a section β copy-paste the object:
{ type: "balloons", count: 25 },
{ type: "balloons", count: 15 }, // shows balloons twice!Reorder β just move them up or down in the array.
| Type | Description | Properties |
|---|---|---|
greeting |
Opening greeting with name | title, subtitle |
countdown |
Animated 3-2-1 countdown | from (start number), goText (finale emoji/text) |
announcement |
Simple announcement text | text |
chatbox |
Chat bubble with typing effect | message, buttonText |
ideas |
Lines revealed one by one | lines[], bigLetters |
quote |
Styled quote card | text, author (optional) |
stars |
Twinkling stars background | count |
fireworks |
Colorful spark burst | count |
balloons |
Floating balloons | count |
profile |
Profile photo + wish text | wishTitle, wishText |
confetti |
Confetti circle burst | count |
closing |
Closing message + replay | text, replayText |
greeting
{ type: "greeting", title: "Hi", subtitle: "I really like your name btw!" }Shows the recipient's name (from top-level config) with a gradient effect.
countdown
{ type: "countdown", from: 3, goText: "π" }Animated countdown from from to 1, then shows goText. Great before announcements!
chatbox
{ type: "chatbox", message: "Happy birthday!!", buttonText: "Send" }Simulates a chat with a typing animation that reveals the message character by character.
ideas
{
type: "ideas",
lines: [
"A normal line.",
"A line with <strong>bold highlight</strong>.",
"Last line gets special animation <span>:)</span>",
],
bigLetters: "SO",
}- Each line appears and disappears sequentially
- Use
<strong>for highlighted words - The last line automatically gets a dramatic animation
bigLetters(optional) β large staggered characters after all lines
quote
{ type: "quote", text: "Every year is a gift.", author: "Unknown" }Glassmorphism card with quotation mark, text, and optional author attribution.
fireworks
{ type: "fireworks", count: 24 }Colorful sparks that burst and scatter in random directions. Overlays on top of other content.
happybirthday/
βββ config.js β β¨ EDIT THIS FILE ONLY
βββ index.html β Page template (do not edit)
βββ script/
β βββ main.js β Engine (do not edit)
β βββ components/ β Section components
β βββ greeting.js
β βββ announcement.js
β βββ chatbox.js
β βββ countdown.js
β βββ ideas.js
β βββ quote.js
β βββ stars.js
β βββ fireworks.js
β βββ balloons.js
β βββ profile.js
β βββ confetti.js
β βββ closing.js
βββ style/
β βββ main.css β Styles (do not edit)
βββ img/ β Put recipient's photo here
βββ music/ β Put background music here
Create a .js file in script/components/ following this template:
(function () {
window.Components = window.Components || {};
window.Components.mycomponent = {
// overlay: true, β Set true if it layers on top of other sections
render(container, section, config) {
const div = document.createElement("div");
div.className = "section section-mycomponent";
div.innerHTML = `<p>${section.text || "Hello!"}</p>`;
container.appendChild(div);
return div;
},
animate(tl, el, config) {
tl.from(el, { duration: 0.7, opacity: 0, y: 20 })
.to(el, { duration: 0.7, opacity: 0 }, "+=3");
},
// Optional: deferred exit (runs after overlays finish)
// exit(tl, el) {
// tl.to(el, { duration: 0.5, opacity: 0 });
// },
};
})();Then use it in config.js:
{ type: "mycomponent", text: "My custom section!" }Don't forget to add CSS for .section-mycomponent in style/main.css.
- GSAP 3 β Animation engine
- SweetAlert2 β Alert dialogs
- Poppins β Google Font
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
If you find this project helpful, please consider giving it a βοΈ star on GitHub or buying me a coffee!
Licensed under the MIT License.
Find me on GitHub Β Β·Β YouTube Β Β·Β Instagram Β Β·Β LinkedIn
