Coder Social home page Coder Social logo

plotter-canvas's Introduction

plotter-canvas

An empty canvas for building plotter art in Processing.

This projects runs full screen (optional) with a proportional canvas showing your sketch in context of the target print size. Output your sketch as plot-ready SVG with optional PNG preview.

Getting Started

Requirements

Setup

Put your sketch code in the Sketch.pde file.

The main app will call your sketch's draw method once per frame.

Config

Set your paper size, pen thickness, and display scaling in the config.pde file.

Usage

Any drawing commands in your sketch's draw method will be output to SVG when saving.

Use the w, h, and ppi variables in to your sketch to position your drawing on the canvas.

Mouse & Keyboard Input

You can use these Processing functions in your sketch to access mouse and keyboard input:
mousePressed()
mouseReleased()
keyPressed()
keyReleased()

Use canvasMouseX and canvasMouseY to get mouse coordinates relative to the canvas.

Responding to Canvas Size Changes

If you need to do something in your project to respond to a change in canvas size, you can implement the setDimensions function:

void setDimensions(int _w, int _h, float _ppi, float _strokeWeight) {
	super.setDimensions(_w, _h, _ppi, _strokeWeight); // you must call super

	// your code here...
}

This function will be called by app.pde any time the canvas size changes. Be sure to call super in order to have the parent class correctly update the canvas values.

Key Commands

s : Save a plot-ready SVG. This also saves a PNG preview image if you have that flag set in the config file.

g : Toggle a visual grid that represents the maximum plot area.

Support

This is a personal project and is mostly unsupported, but I'm happy to hear feedback or answer questions.

License

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


๐Ÿ‘จ๐Ÿปโ€๐Ÿฆฒโค๏ธ๐Ÿ› 

plotter-canvas's People

Contributors

cadin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.