Skip to content

meganetaaan/mouse-follower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

68 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Mouse Follower Monorepo

CI npm version License: MIT

A monorepo for the mouse-follower library and its demo application.

๐Ÿš€ Live Demo

Packages

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

View package README โ†’

An interactive demo application showcasing the library's capabilities.

  • Multiple follower examples
  • Formation demonstrations
  • Event-driven animations
  • Stack-chan sprite integration

Development

This project uses pnpm workspace for package management.

Prerequisites

  • Node.js 18+
  • pnpm 8+

Getting Started

# 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

Workspace Structure

.
โ”œโ”€โ”€ 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

Development Workflow

Starting Development

# 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 changes

Working on the Library

cd packages/mouse-follower
pnpm dev           # Run TypeScript in watch mode
pnpm test          # Run tests once
pnpm build         # Build the library for production

Working on the Demo Only

cd packages/demo
pnpm dev           # Start Vite dev server (requires library to be built)

Publishing

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:lib

Testing

The 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 report

Contributing

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors