sketch board with Javascript
Features:
current status of active tool
brush color and size,background color
erase and reset
set , get and delete localStorage
save the canvas image
Code Github
HTML
active tool is the status of current tool
the brush color is based on jscolor ,which can be custom
the brush size is the slider from 1 to 50
eraser is the background color brush
CSS
JAVASCRIPT
when change brush size,current size value is changed and format with displayBrushSize function
when change bucket color,bucket color value is changed and begin to createCanvas and restoreCanvas
when eraser clicked,current color set to background color and size to 50
and run switchToBrush function to begin sketching
get the mouse axis with getBoundingClintRect()
When mousedown,begin to draw with mouse position origin
load the canvas if any there,and transfer strings to objects to array
clear storage with removeItem()
Download the canvas with toDataURL()
the download file init name is .download
all the setTimeout inside the function