hand draw on canvas with JavaScript? - Javascript Canvas

Javascript examples for Canvas:Draw

Description

hand draw on canvas with JavaScript?

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.4.0/fabric.min.js"></script> 
      <style id="compiled-css" type="text/css">

#sheet-container {//ww  w . j a v  a 2 s .  com
   width: 400px;
   height: 400px;
   border: 1px solid black;
}


      </style> 
      <script type="text/javascript">
    window.onload=function(){
var canvas = new fabric.Canvas('sheet');
canvas.isDrawingMode = true;
canvas.freeDrawingBrush.width = 1;
canvas.freeDrawingBrush.color = "#ff0000";
console.log(canvas);
    }

      </script> 
   </head> 
   <body> 
      <div id="sheet-container"> 
         <canvas id="sheet" width="400" height="400"></canvas> 
      </div>  
   </body>
</html>

Related Tutorials