Template for canvas html5/jquery/javascript -
Template for canvas html5/jquery/javascript -
i beginner @ html5, jquery/javascript. attempting create canvas (sort of windows paint application) , looking @ other users sample functions/code see whats going on , effort re-create it.
$(function(){ var paint = new paint($('#surface').get(0)); // setup line template var templateline = new paint($('#toolbar #line').get(0), {'readonly': true}); templateline.shape = new line([10, 10], [50, 50]); templateline.place(templateline.shape);
i unsure going on here. know new paint not internal built-in function. it? secondly whats difference between ,
$( document).ready(function(){ var canvas = $("#canvas").get(0); if (canvas.getcontext) { var ctx = canvas.getcontext("2d"); // take color ctx.fillstyle = "black"; ctx.strokestyle = color; ctx.fillrect(0, 0, 50, 50); } else { // browser doesn't back upwards canvas } });
help!!!
well, first off, code you're looking @ in origin of question using canvas library or api, not vanilla html5 canvas api, making different you've written below, if have same output (although doesn't do).
secondly, color
not defined, unless that's defined in code somewhere else, code's not going work. otherwise, code draw black rectangle in corner of canvas stroke color of whatever color
is.
javascript jquery html5-canvas
Comments
Post a Comment