A monorepo for the mouse-follower library and its demo application.
๐ Live Demo
This monorepo contains the following packages:
The main library for creating animated sprites that smoothly follow the mouse cursor using physics-based movement.
- ๐ฏ Smooth physics-based following animation
- ๐จ Canvas-based sprite rendering with transparency support
- ๐ Chain multiple followers in formation
- โก High-performance animation with requestAnimationFrame
- ๐ฎ Customizable physics parameters
- ๐ฑ Works on both desktop and mobile devices
An interactive demo application showcasing the library's capabilities.
- Multiple follower examples
- Formation demonstrations
- Event-driven animations
- Stack-chan sprite integration
This project uses pnpm workspace for package management.
- Node.js 18+
- pnpm 8+
# Install dependencies for all packages
pnpm install
# Start development servers (library watch + demo dev)
# This runs both TypeScript watch for the library and Vite dev server for the demo in parallel
pnpm dev
# Run tests for the library
pnpm test
# Build all packages
pnpm build
# Build library only
pnpm build:lib
# Build demo only
pnpm build:demo
# Lint and format all packages
pnpm check:fix.
โโโ packages/
โ โโโ mouse-follower/ # Main library (@meganetaaan/mouse-follower)
โ โ โโโ src/ # Library source code
โ โ โโโ test/ # Library tests
โ โ โโโ README.md # Library documentation
โ โโโ demo/ # Demo application (private)
โ โโโ src/ # Demo source code
โ โโโ public/ # Demo static assets
โโโ docs/ # Project documentation
โโโ CLAUDE.md # AI assistant instructions
โโโ CONTRIBUTING.md # Contribution guidelines
โโโ README.md # This file
# From root directory - starts both library (TypeScript watch) and demo (Vite) in parallel
pnpm dev
# The library will automatically rebuild on changes
# The demo will hot-reload with the latest library changescd packages/mouse-follower
pnpm dev # Run TypeScript in watch mode
pnpm test # Run tests once
pnpm build # Build the library for productioncd packages/demo
pnpm dev # Start Vite dev server (requires library to be built)The library package is published to npm. To publish a new version:
# Build and test
pnpm build:lib
pnpm test
# Publish (from root)
pnpm publish:libThe library uses Vitest with jsdom for testing:
- Unit tests for physics calculations
- DOM manipulation tests
- Animation system tests
- Sprite rendering tests
Run tests with:
pnpm test # Run once
pnpm test --watch # Watch mode
pnpm test --coverage # Coverage reportPlease read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.