npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-natural-mouse

v1.0.1

Published

Node.js module for natural mouse motion

Downloads

4

Readme

Giving credit for initial implementation: https://github.com/JoonasVali/NaturalMouseMotion

And also for the C++11 translation: https://github.com/barrybingo/CNaturalMouseMotion

There are missing features in the C++11 implementation, and I will be adding them as I need them. I will also be adding a few more features that I think are useful.

Installation Instructions

npm install natural-mouse-motion
yarn add natural-mouse-motion

Usage

const { move } = require('natural-mouse-motion');

move("fastGamer", 250, 250);

Below is the original README.md from the C++ implementation:

CNaturalMouseMotion

Move the mouse like a human via code.

This is a C++11 header only port of Joonas Vali's Java NatualMouseMotion at https://github.com/JoonasVali/NaturalMouseMotion

Distinctions:

  • Less factories
  • No getters/setters
  • Classes that wrap single functions have been replaced by std::function, or structs with operator() that can be contained in std::function
  • No ScreenAdjustedNature - TODO possibly add later; for multiple screens could add a screen parameter to nature or move(x,y,screen)
  • Move is a single function that takes a nature and coordinates, so everything not coordinates resides in MotionNature

Features:

  • Deviation: Deviation leads the mouse away from direct trajectory, creating and arc instead of straight line
  • Noise: Noise creates errors in the movement, this can simulate hand shakiness, someone using a non accurate mouse or bad surface under the mouse.
  • Speed and flow: Speed and flow are defining the progressing of the mouse at given time, for example it's possible that movement starts slow and then gains speed, or is just variating.
  • Overshoots: Overshoots happen if user is not 100% accurate with the mouse and hits an area next to the target instead, requiring to adjust the cursor to reach the actual target.
  • Coordinate translation: Coordinate translation allows to specify offset and dimensions to restrict a movement in a different area than the screen or in a virtual screen inside the real screen.

Usage:

Moving the mouse requires destination cooridnates and a nature of movement. Destination cooridnates are self exmplanatory though require a little thinking about with multiple screens.

#include "NaturalMouseMotion.h"
int main(int argc, char** argv)
{
    auto nature = NaturalMouseMotion::DefaultNature::NewFastGamerNature();
    NaturalMouseMotion::Move(&nature, 250, 250);
    return 0;
}

Building Tests and Example:

Linux:

mkdir build
cd build
cmake ..
make
# Run tests
./Test/NaturalMouseMotion_test

# Run the example CLI
./Example/NaturalMouseMotion -i -f -x 500 -y 500

Windows:

Easy way is to use VSCode with a cmake plugin (CMake Tools) and a gtest plugin (GoogleTest Adapter)

Precooked Natures

  • GrannyMotionNature is a slow and clumsy mouse movement with a lot of noise.
  • FastGamerMotionNature is a fast and persistent movement with low noise, simulating behavior of someone who knows where the click should land, like a professional gamer.
  • AverageComputerUserMotionNature is a medium speed movement with average settings, slower than fast gamer, but much faster than granny motion.
  • RobotMotionNature is featureless constant speed robotic movement with no mistakes.

TODO

  • ScreenAdjustedNature or at least support multiple screens
  • Remove throws