| <html> | |
| <body> | |
| <canvas width="100" height="100" style="border: solid 1px gray"></canvas> | |
| <script> | |
| const iterations = 10; | |
| const increment = 4; | |
| const canvas = document.getElementsByTagName('canvas')[0]; | |
| const width = canvas.width; | |
| const ctx = canvas.getContext('2d'); | |
| ctx.font = "10px monospace"; | |
| ctx.fillStyle = "blue"; | |
| for (let i = 0; i < iterations; ++i) { | |
| const x = width + (i - iterations / 2) * increment; | |
| const y = i * 10; | |
| ctx.fillText("Hi", x, y); | |
| } | |
| </script> | |
| </body> | |
| </html> |