javascript - adding many shapes triggered from button in fabricjs library -
i'am making draw application using fabricjs library there button each shape create question how write code each time click on button create shape , added canvas many click ,, i.e if want 5 circles click on circle button 5 times ans on ....i'am making draw application using fabricjs library there button each shape create question how write code each time click on button create shape , added canvas many click ,, i.e if want 5 circles click on circle button 5 times ans on ....
please try one
<html> <head> <script src="scripts\jquery-1.11.1.min.js"> </script> <script src="scripts\fabric.min.js"></script> <script type="text/javascript"> jquery(function($){ var canvas = new fabric.canvas('c'); $("#addcircle").click(function(){ canvas.add(new fabric.circle({ radius: 20, fill: 'green', left: 100, top: 100 })); }); }); </script> </head> <body> <div id="wrapper"> <div id="editor"> <input type="button" id="addcircle" value="add circle"></div> <canvas id="c" width="300" height="300"></canvas> </div> </body>
hope helps
Comments
Post a Comment