i need draw diagram given below using html canvas.can me.
http://1.bp.blogspot.com/-em2abceg5nu/ts_c3cntfmi/aaaaaaaaabu/eqwc6sjtd0m/s1600/t31.jpg
first access canvas:
var can=document.getelementbyid('canvas1')
now need context perform drawing functions:
var pen=can.getcontext('2d')
to draw line following:
pen.beginpath() pen.moveto(0,0) pen.lineto(50,50) pen.closepath() pen.strokestyle=rgb(255,0,0) pen.stroke()
to fill path (like triangle) following:
pen.beginpath() pen.moveto(0,0) pen.lineto(50,50) pen.lineto(0,50) pen.closepath() pen.fillstyle=rgb(255,0,0) pen.fill()
Comments
Post a Comment