diff options
Diffstat (limited to 'www')
| -rw-r--r-- | www/scripts/test.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/www/scripts/test.js b/www/scripts/test.js index a48327c..e9afd91 100644 --- a/www/scripts/test.js +++ b/www/scripts/test.js @@ -1,9 +1,14 @@ const canvas = document.getElementById("JSCanvas"); const ctx = canvas.getContext("2d"); -ctx.strokeStyle = "blue" -ctx.beginPath(); -ctx.moveTo(0, 0); -ctx.lineTo(511, 511); -ctx.stroke(); +function draw() { + ctx.strokeStyle = "#" + Math.floor(Math.random() * 16777216).toString(16).padStart(6, '0') + ctx.beginPath(); + ctx.moveTo(Math.random() * 511, Math.random() * 511); + ctx.lineTo(Math.random() * 511, Math.random() * 511); + ctx.stroke(); +} +for (let i = 0; i < 50; i++) { + draw() +} |