A lightweight, festive front-end project built with vanilla JavaScript and HTML5 Canvas.
Users can launch fireworks with mouse interaction and cycle through character avatars, all inside a fullscreen animated scene.
This project demonstrates:
- Canvas animation and particle effects without external libraries.
- Real-time mouse-driven interaction.
- Layered rendering with multiple canvases.
- Clean separation of concerns across small focused scripts.
- Visual styling and motion design using only CSS and native browser APIs.
Add your deployed URL here once published:
https://hhok95.github.io/Fireworks
- Build an engaging, interactive browser animation from scratch.
- Practice object-based animation architecture (
Firework,Fleckclasses). - Keep the stack minimal and dependency-free.
- Create a portfolio-ready artifact that is easy to run and easy to explain.
- Fullscreen gradient sky background.
- Starfield and layered foreground for depth.
- Mouse-aimed fireworks launch and explosion effects.
- Particle trails with friction, gravity, and fade-out decay.
- Clickable avatar cycling through themed character images.
- Animated heading text using CSS gradient movement.
- HTML5
- CSS3
- JavaScript (ES6)
- HTML Canvas 2D API
No framework and no build tooling required.
Fireworks/
├── assets/
│ ├── bear.png
│ ├── cookie.png
│ ├── reindeer.png
│ ├── santa.png
│ └── snowman.png
├── index.html
├── styles.css
├── avatar-toggle.js
├── canvas-background.js
└── canvas-fireworks.js
index.html- Defines UI text, avatar image, and two stacked canvases.
- Loads all scripts directly in the browser.
styles.css- Handles layout, layering, typography, and title animation.
canvas-background.js- Renders static scene elements (gradient sky, ground, stars).
canvas-fireworks.js- Manages animation loop, user input, projectile paths, and particle systems.
avatar-toggle.js- Cycles avatar images on click.
On load, both canvases are sized to the viewport.
The background canvas is painted once.
The fireworks canvas runs a continuous animation loop (requestAnimationFrame).
- Mouse position becomes the target coordinate.
- Holding mouse click spawns fireworks from a bottom anchor point.
- Clicking the avatar switches to the next character image.
- A
Fireworklaunches from the anchor toward the mouse target. - Once it reaches target distance, it spawns multiple
Fleckparticles. - Particles fade with alpha decay and are removed from arrays when finished.
Because this is a static project, there are two simple options:
- Open
index.htmldirectly in a browser. - Or run a local server from the project root:
python3 -m http.server 8080Then visit http://localhost:8080.
- Create a new GitHub repository.
- Push this project to
main. - In repository settings, enable GitHub Pages from branch
main(root). - Your site will be available at:
https://<your-username>.github.io/<repo-name>/
If you include this project in your portfolio, emphasize:
- Implemented interactive particle physics using friction, gravity, and alpha decay.
- Structured animation logic into reusable classes.
- Balanced visual quality with performance via controlled particle counts.
- Delivered a polished experience with no framework overhead.
- Add touch support for mobile fireworks launch.
- Make scene responsive to window resize after load.
- Add sound effects with optional mute toggle.
- Add keyboard accessibility and ARIA improvements.
- Add configurable color themes and firework presets.
- Include FPS/performance instrumentation for optimization analysis.
- Fonts loaded from Google Fonts (
Pacifico,Work Sans). - Character image assets are stored in
assets/.
No license file is currently included.
For public portfolio use, consider adding an MIT license.