A powerful TypeScript library for creating interactive canvas backgrounds.
npm install @haandev/canvasbg
import { CanvasBG, StarField, Constellation } from "@haandev/canvasbg";
// Create a canvas element or select an existing one
const canvas = document.createElement("canvas");
document.body.appendChild(canvas);
// Create a CanvasBG instance and set up a star field background
const bg = new CanvasBG(canvas);
const starField = new StarField();
bg.use(starField);
// Display constellations on the star field background
const constellation = new Constellation();
bg.use(constellation);
// Start the animation loop
bg.animate();
For detailed usage instructions and API reference, please refer to the Documentation. https://haandev.github.io/canvasbg/
For examples on how to use CanvasBG, please refer to the Examples. https://canvasbg.vercel.app/
Contributions are welcome! Please read the Contribution Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.