1.1.22 • Published 10 months ago

doodle-board v1.1.22

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Dreamweaver

npm npm npm

A simple doodle for use in html5, There are some features that are not easy to use, I am trying to update. Pure JavaScript, No other dependence image

Example

<canvas id="draw" width=200 height=200 style="border: 2px solid #94FC13;"></canvas>
<div id="bar">
  <div id="painter"></div>
  <br />
  <div id="tool"></div>
  <br />
  <canvas id="colorBar" width=200 height=150 style="padding-top:2%"></canvas>
</div>
import Dreamweaver from 'doodle-board';
new Dreamweaver(document.getElementById("draw"), document.getElementById("bar"), true)

Advanced

<canvas id="draw" width=200 height=200 style="border: 2px solid #94FC13;"></canvas>
<div id="bar">
  <!-- Drawing tool -->
  <div id="painter">
    <button id="pen"><!-- Your picture --></button>
    <button id="round"></button>
    <button id="square"></button>
    <button id="arrow"></button>
    <button id="rubber"></button>
    <!-- <button id="text"></button> under development -->
  </div>
  <br />
  <!-- Modification tool -->
  <div id="tool">
    <button id="open"></button>
    <button id="close"></button>
    <button id="undo"></button>
    <button id="redo"></button>
    <button id="save"></button>
    <button id="delete"></button>
  </div>
  <br />
  <!-- Brush size -->
  <!-- <input onchange="onChangeFontSize" /> under development  -->
  <br />
  <!-- Color selection -->
  <canvas id="colorBar" width=200 height=150 style="padding-top:2%"></canvas>
</div>
import Dreamweaver, { DW_curtain, DW_brush, featureFun, colorBarDraw } from 'doodle-board';
const dw_curtain = DW_curtain;
const dw_brush = DW_brush
window.onload = () => {
  dw_curtain.canvas = document.getElementById("draw");
  dw_brush.div = document.getElementById("bar")
  new Dreamweaver(dw_curtain.canvas, dw_brush.div, true)
  document.getElementById('save').addEventListener('click', () => {  
    saveImg();
  });  
}
// Save the image to local
const saveImg = () => {
  let link = document.createElement('a')
  link.download = 'image.png';
  link.href = featureFun('save', dw_curtain).src
  link.click()
}
// Change brush color
const changeColor = () => {
  dw_curtain.ctx.strokeStyle = "rgba(255,0,0,1)";
  colorBarDraw(2, dw_brush, dw_curtain)
}
1.1.22

10 months ago

1.1.21

11 months ago

1.1.20

11 months ago

1.1.19

11 months ago

1.1.18

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.1.9

11 months ago

1.1.8

11 months ago

1.1.7

11 months ago

1.1.6

11 months ago

1.1.5

11 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.12

11 months ago

1.1.11

11 months ago

1.1.10

11 months ago

1.1.16

11 months ago

1.1.15

11 months ago

1.1.14

11 months ago

1.1.13

11 months ago

1.1.17

11 months ago

1.0.17

11 months ago

1.0.16

11 months ago

1.0.11

11 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.10

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago