This is a Node.js application that uses the robotjs
library to move the mouse in a circle on the screen. It accepts several command-line arguments to customize the behavior of the mouse movement.
First, make sure you have Node.js installed on your machine. Then, clone this repository and install the dependencies:
git clone [email protected]:heystevegray/spin-mouse.git
cd spin-mouse
npm install
or
git clone https://github.com/heystevegray/spin-mouse.git
cd spin-mouse
npm install
You can run the application with npx ts-node index.ts
followed by any options you want to use:
npx ts-node index.ts --radius 200 --speed 0.2 --wait 1
-r, --radius <number>
: The radius of the circle in pixels that the mouse will move in. The default value is100
.-s, --speed <number>
: The speed in milliseconds of the mouse movement. The default value is0.1
.-w, --wait <number>
: The wait time in seconds between each spin cycle. The default value is0.5
.-d, --debug <boolean>
: Pass this option to output debug information. The default value isfalse
.--help
: Show help information about how to use the program and its options.
The program can be terminated in two ways:
-
User-Initiated Mouse Movement: If the mouse is moved manually, the program will detect this action and terminate automatically.
-
Keyboard Interrupt: You can also stop the program by using the keyboard interrupt command. On most systems, this is
Command + C
.
The application first parses the command-line arguments using the yargs library. It then gets the size of the screen using robotjs
, and uses this information along with the provided options to calculate the path of the mouse movement. The mouse is then moved in a circle on the screen using robotjs
.