canvasmouse-doudoutea

1.0.0 • Public • Published

Canvas Mouse Follow Animation

This project demonstrates a simple JavaScript animation using Canvas where a circle follows the mouse cursor.

Overview

The animation is implemented using HTML canvas and JavaScript. The circle's position is updated continuously to follow the mouse cursor on the canvas. The animation loop is created using requestAnimationFrame() for smooth rendering.

Usage

Clone or download the repository to your local machine. Open the index.html file in a web browser.

How it Works

The index.js file contains the JavaScript code responsible for setting up the canvas, tracking mouse movements, and drawing the circle. The mousemove event listener updates the position of the mouse cursor. The animate() function clears the canvas, calculates the new position of the circle based on the mouse position, and draws the circle on the canvas. The animation loop is initiated by calling the animate() function recursively using requestAnimationFrame().

License

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

Readme

Keywords

Package Sidebar

Install

npm i canvasmouse-doudoutea

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

2.9 kB

Total Files

3

Last publish

Collaborators

  • doudoutea