0
About ctx.textAlign
As the code below, if the "ctx.textAlign" is not included in the code, will the result be influenced?? Since I have tried it and the result did not be influenced, I do not clearly understand the meaning of " ctx.textAlign ". Thank you for your help! <html> <head></head> <body> <canvas id="canvas1" width="400" height="400"> </canvas> <script> var canvas = document.getElementById('canvas1'); ctx =canvas.getContext('2d'); ctx.font="bold 22px Tahoma"; ctx.textAlign="start"; ctx.fillText("start", 10, 30); ctx.translate(100, 150); ctx.fillText("after translate", 0, 0); ctx.rotate(1); ctx.fillText("after rotate", 0, 0); ctx.scale(1.5, 4); ctx.fillText("after scale", 0,20); </script> </body> </html>
1 Answer
+ 1
"start" is the default value so that isn't actually changing anything. Try setting it to "end"!



