|
|
|
|
|
by qsera
68 days ago
|
|
>Regarding your examples: PSET corresponds to `ctx.fillRect(x, y, 1, 1)` on a canvas, reading a pixel corresponds to `ctx.getImageData(x, y, 1, 1)`. What is a `ctx` and why do I need that? These are all hacks. Graphics programming in bolted on HTML in the form of canvas. It is a horrible platform for doing fun graphics programming when compared to qbasic. >For delays, you define "sleep" (one line) and write "await sleep(500)" inside a loop, just like with "SLEEP" in QBASIC. Kindly provide the code for this sleep function and tell me how a beginner who is trying draw some graphics on screen is supposed to figure that. |
|
For sleep: const sleep = (ms) => new Promise(x => setTimeout(x, ms))
then you use like, for(;;) { console.log("hello"); await sleep(1000); }
The extra you get with this is the awesome dev tools. You can try it in this very page.