diff options
| author | UltraQbik <no1skill@yandex.ru> | 2024-08-25 17:49:01 +0300 |
|---|---|---|
| committer | UltraQbik <no1skill@yandex.ru> | 2024-08-25 17:49:01 +0300 |
| commit | d0867343856568fec2ca3c4dca6555bae1c52548 (patch) | |
| tree | 80eb98fb4886163e40dde26de3497723abf9513b | |
| parent | b26ddf519358cb9c87256059a13fb378621596a5 (diff) | |
| download | httpy-d0867343856568fec2ca3c4dca6555bae1c52548.tar.gz httpy-d0867343856568fec2ca3c4dca6555bae1c52548.zip | |
I hate JS
| -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() +} |