Git Product home page Git Product logo

node-autodrawer's Introduction

Node.js Autodrawer for Paint 3D

An Autodrawer for Paint 3D created using Node.js and Robot.js. A recreation of my Python Autodrawer for Paint 3D but now using Node.

Sections:


1. Requirements

2. Setting up

Before starting, it's necessary to set up some values which the drawer will rely upon.

2.0 config.json

config.json holds the main parameters for the program. It is located at the root folder. The default values should look like this:

{
    "useDefaultPositions": false,
    "useDefaultValues": false,
    "delayFactor": 1,
    "imageLocation": "../res/test4.png",
    "positionsLocation": "../res/positions.json",
    "valuesLocation": "../res/values.json"
}
  • "useDefaultPositions" and "useDefaultValues": determines if the default values (located inside "src/json") are going to be used instead of "positionsLocation" and "valuesLocation". The default positions are based on my monitor's resolution (1920x1080) and a 4000x3000 canvas. It might work well if you have the same resolution and canvas size as me.
  • "delayFactor": determines the sleep multiplier. Inside the code, there is the "sleep" method, which takes a time in milliseconds as argument. This value is multiplied by this "delayFactor".
  • "imageLocation": path to the image. It is recommended to use an absolute path.
  • "positionsLocation": path to the positions file. This file holds the coordinates that will be used to interact with Paint 3D's UI.
  • "valuesLocation": path to the values file. This file holds the values that will be used to set Paint 3D's tools.

2.1 positionsLocation / Positions

It is also necessary to set up the "positions.json" file, a file which holds the coordinates that will be used to interact with Paint 3D's UI. The default values - as stated previously - are based on my 1920x1080 monitor and 4000x3000 canvas. Each point is based of the XY screen's position of the Paint 3D's element. Documentation for every point is available here.

2.2 Values

values.json is the file that holds values which will be set on Paint 3D. The default values file should look like this:

{
    "zoom": 25,
    "brushSize": 7,
    "brushOpacity": 75,
    "tool": "graphitepencil"
}
  • "zoom": amount of zoom that will be set.
  • "brushSize": thickness of the tool.
  • "brushOpacity": opacity of the tool.
  • "tool": tool which will be used. Available options are: "marker", "watercolor", "pixelpencil", "graphitepencil" and "crayon".

2.3 Installing dependencies

Open the terminal at the root folder then type npm i. All the dependencies will be downloaded and installed.

2.4 Building

Open the terminal at the root folder then type npm run build. The project will be built to the "dist" directory.

3. Usage

Once the project is built, open the terminal at the root folder and type npm start to execute the program. Then maximizes Paint 3D and let the drawer do its job.

4. FAQ

Q: Is there any hotkey to stop the drawer?

  • R: Sadly I couldn't implement this feature. I tried to use some global keyboard listeners but no one succeeded.

Q: Will there ever be a GUI version of this drawer?

  • R: That's my current plan right now. I will try to use this piece of code to build a desktop app using Electron

5. License

Feel free to do whatever you want with this code :)

node-autodrawer's People

Contributors

felipeflohr avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.