this is interface for drawing on target canvas tag.
https://github.com/YujiSODE/canvasPenJS
Copyright (c) 2016 Yuji SODE <yuji.sode@gmail.com>
This software is released under the MIT License.
See LICENSE or http://opensource.org/licenses/mit-license.php
canvasPenJS.js
canvasPenJS_min.js
This is minimum white spaces and comments version of "canvasPenJS.js
".canvasPenJS_usingMDNCodeSamples.js
If "canvasPenJS.js
" does not work, please try to use this instead.
- Call "
_canvasPenJS(canvas,rgba,w,plot)
" in a html file with canvas tag.
Examples
0) var y,d=window.document.getElementsByTagName('canvas')[0];
-
[Set drawing]:
y=_canvasPenJS(d,'rgba(255,0,0,1)',2,false);
-
[Remove set interface for drawing, and get log]:
y();
-
[Set plotting]:
y=_canvasPenJS(d,'rgba(0,0,255,1)',10,true);
-
[Remove set interface for plotting, and get log]:
y();
-
[Set plotting with data]:
y=_canvasPenJS(d,'rgba(255,0,255,1)',10,"20@+13.14");
-
[Get log]:
y();
canvas
: target canvas tagrgba
: colorw
: line widthplot
:true
|false
;true
=> plotting,false
=> drawing.
plot
(=true
) can be a text: a pair of values with @, expressed as "x@y" e.g., "1@2", "10.5@100.31".
Function that removes set drawing/plotting interface, and returns log object.
This log object has:
time
: timestampd
: an array of plots, expressed with x and y coordinates: "x@y".canvasId
: id of canvas