All Projects → Kaier33 → easy-drawing-board

Kaier33 / easy-drawing-board

Licence: MIT license
🎨 a easy to use canvas-drawing lib

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
Less
1899 projects

Projects that are alternatives of or similar to easy-drawing-board

Noodle
Small, Sharp Sketch Tool
Stars: ✭ 151 (+371.88%)
Mutual labels:  drawing
Storyboarder
✏️ Storyboarder makes it easy to visualize a story as fast you can draw stick figures.
Stars: ✭ 2,467 (+7609.38%)
Mutual labels:  drawing
Makelangelo Software
Software for plotters - especially the wall-hanging polargraph also called Makelangelo.
Stars: ✭ 248 (+675%)
Mutual labels:  drawing
Godot Texture Painter
A GPU-accelerated texture painter written in Godot 3.0
Stars: ✭ 155 (+384.38%)
Mutual labels:  drawing
Librecad 3
LibreCAD 3 is a next generation 2D CAD application written to be modular, with a core independent from GUI toolkits. Scripting is possible with Lua.
Stars: ✭ 189 (+490.63%)
Mutual labels:  drawing
Autocadcodepack
AutoCAD Code Pack: A powerful library that helps you to develop AutoCAD plugins using the AutoCAD .NET API
Stars: ✭ 207 (+546.88%)
Mutual labels:  drawing
Moebius
Modern ANSI & ASCII Art Editor
Stars: ✭ 138 (+331.25%)
Mutual labels:  drawing
voxel-builder
Voxel-based 3D modeling application
Stars: ✭ 31 (-3.12%)
Mutual labels:  drawing
Librecad
LibreCAD is a cross-platform 2D CAD program written in C++11 using the Qt framework. It can read DXF and DWG files and can write DXF, PDF and SVG files. The user interface is highly customizable, and has dozens of translations.
Stars: ✭ 2,602 (+8031.25%)
Mutual labels:  drawing
Swiftydraw
A simple, lightweight drawing framework written in Swift
Stars: ✭ 239 (+646.88%)
Mutual labels:  drawing
Lazy Line Painter
Lazy Line Painter - A Modern JS library for SVG path animation
Stars: ✭ 1,918 (+5893.75%)
Mutual labels:  drawing
Scribble.rs
A skribbl.io alternative - Play at https://scribblers-official.herokuapp.com/
Stars: ✭ 188 (+487.5%)
Mutual labels:  drawing
Gbox
🎨 A multi-platform graphic library
Stars: ✭ 216 (+575%)
Mutual labels:  drawing
Mypaint
MyPaint is a simple drawing and painting program that works well with Wacom-style graphics tablets.
Stars: ✭ 2,072 (+6375%)
Mutual labels:  drawing
powerpaint
Kreative PowerPaint - Library and Application for Bitmap and Vector Image Editing
Stars: ✭ 27 (-15.62%)
Mutual labels:  drawing
Drawbot
Drawing robot capable of rendering SVG paths over WebSockets. Powered by a Raspberry Pi running Node.js.
Stars: ✭ 142 (+343.75%)
Mutual labels:  drawing
Pencil.js
✏️ Nice modular interactive 2D drawing library
Stars: ✭ 204 (+537.5%)
Mutual labels:  drawing
SwiftyJot
Use your finger to annotate images.
Stars: ✭ 14 (-56.25%)
Mutual labels:  drawing
Butterfly
🎨 Powerful, minimalistic, cross-platform, opensource note-taking app
Stars: ✭ 381 (+1090.63%)
Mutual labels:  drawing
Sketch
Sketch have a lot of basic functions to develop a drawing app for iPhone. Anyone can easily create drawing iOS Application.
Stars: ✭ 229 (+615.63%)
Mutual labels:  drawing

easy-drawing-board

a easy to use drawing board lib 🎨

  • 0 dependencies
  • Modern browser compatibility

Installing

Using npm:

npm install easy-drawing-board

Using yarn:

yarn add easy-drawing-board

Using script tag

<script src="your_path/dist/easy-drawing-board.min.js"></script>

Play

live example

or

git clone this repository then open example/index.html in your browser

example1

example1

Usage

Initialize

<script type="text/javascript" src="//{you path to the dist file}/dist/easy-drawing-board.min.js"></script>
<style>.container { width: 500px; height: 500px; }</style>
<div class="container"></div>
// More options are available in the following documents
const options = {
  container: document.getElementsByClassName('container')[0]
}
/*
  A canvas has 2 sizes, the dimension of the pixels in the canvas and the display size. 
  canvas's dimension of the pixels is (devicePixelRatio * canvas's display size) by default.
  canvas's display size equals container's size (width/height)
*/  
const draw = new EasyDrawingBoard(options); 

Options

Options Type Default value Description
container HtmlDom (required) / Container for canvas
bgImg String Empty string Canvas background Image's url, if you needed.
canvasBgColor String #fff Canvas background Color
lineColor String #f00 Color of brush
lineWidth String / Number 1 Width of brush
arrowSize String / Number 15 Size of arrows
eraserSize String / Number 10 Size of eraser
textFontSize String / Number 16 Font size of the textArea
textLineHeight String / Number 20 Font lineheight of the textArea
textColor String #f00 Font color of the textArea
textareaPlaceholder String Type here... Textarea's placeholder
ratio Nubmer window.devicePixelRatio Affects the quality of the picture

APIs

Method Arguments Description
config( type,val ) tpye's enum(lineColor, lineWidth, arrowSize, eraserSize, canvasBgColor, textFontSize, textLineHeight, textColor, bgImg, textareaPlaceholder, ratio) Modifying the default configuration
setMode( mode ) mode's enum(pencil, straightLine, rect, circle, arrow, text, eraser) Set current mode
saveImg( [options] ) default value { tpye: 'png', fileName: 'canvas_imgae' } Save the canvas as an image, and download.
generateBase64([type]) default value "png" Generate Base64 data
undo() / Undo operation
redo() / Redo operation
clear() / Clear canvas

Listeners

coords it will return canvas's coords (x, y) and Mouse's coords (clientX, clientY)

drawBegin
  import EasyDrawingBoard from 'easy-drawing-board'
  const draw = new EasyDrawingBoard({container: Dom})
  draw.evt.on('drawBegin', function(coords) {
    console.log('begin', coords);  
  })
drawing
  draw.evt.on('drawing', function(coords) {
    console.log('drawing', coords);  
  })
drawEnd
  draw.evt.on('drawEnd', function(coords) {
    console.log('end', coords);
  })

removeListeners

  draw.evt.off('drawBegin');
  draw.evt.off('drawing');
  draw.evt.off('drawEnd');
  // or
  draw.evt.removeAllListeners();

Example

  // init
  import EasyDrawingBoard from 'easy-drawing-board'
  const container = document.getElementsByClassName('container')[0]
  const draw = new EasyDrawingBoard({container: container})

  // methods
  draw.conifg('lineColor', '#FF1493')                         // Change the color of the brush.
  draw.setMode('rect')                                        // Now you can draw the rectangle.

  draw.generateBase64().then(data => console.log(data))       // generateBase64 method default is to export the PNG base64 data.                              
  draw.generateBase64('jpeg').then(data => console.log(data)) // get smaller data.                          

  draw.saveImg()                                              // Save the canvas as an PNG images, and the file name is canvas_imgae.png.
  draw.saveImg({fileName: '233.png'})                         // Just Change of file name.
  draw.saveImg({tpye: 'jpeg', fileName: 'small.jpeg'})        // Sometimes we just need smaller pictures.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].