HTML5 Canvas - Text ontop of rectangle -
HTML5 Canvas - Text ontop of rectangle -
my code this
for(var = 0; < data.data.length; i++) { context.beginpath(); context.fillstyle = '#d0d0d0'; context.rect(data.data[i].x, data.data[i].y, 200, 25); context.fill(); context.linewidth = 1; context.strokestyle = 'black'; context.stroke(); context.fillstyle = 'black'; context.font = 'bold 20px serif'; context.filltext("1212a", data.data[i].x, data.data[i].y + 20); } draws rectnagle stroke text beeing draw underneath rectangle tried changing order of code still underneath...
there there doesn't seem wrong code. problem might result of caching.
class="snippet-code-js lang-js prettyprint-override">var canvas=document.getelementbyid("main"); var context=canvas.getcontext("2d"); var x = 80; var y = 50; context.beginpath(); context.fillstyle = '#d0d0d0'; context.rect(x, y, 200, 25); context.fill(); context.linewidth = 1; context.strokestyle = 'black'; context.stroke(); context.fillstyle = 'black'; context.font = 'bold 20px serif'; context.filltext("1212a", x, y + 20); class="snippet-code-html lang-html prettyprint-override"><canvas id="main" width="300px" height="100px"> text displayed if browser not back upwards html5 canvas. </canvas>
html5 canvas
Comments
Post a Comment