aboutsummaryrefslogtreecommitdiff
path: root/sketches/week-1/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'sketches/week-1/script.js')
-rw-r--r--sketches/week-1/script.js36
1 files changed, 0 insertions, 36 deletions
diff --git a/sketches/week-1/script.js b/sketches/week-1/script.js
deleted file mode 100644
index 9c1eaba..0000000
--- a/sketches/week-1/script.js
+++ /dev/null
@@ -1,36 +0,0 @@
-const program = (url) =>
- fetch(url)
- .then((f) => f.text())
- .then(bqn)
-
-const setupCanvas = (width, height) => {
- const $canvas = Object.assign(document.createElement('canvas'), { width, height })
- const ctx = $canvas.getContext('2d')
- $canvas.parentNode || document.body.appendChild($canvas)
- return ctx
-}
-
-const start = async () => {
- console.dir(bqn)
- sysvals.show = (x) => debug(x)
-
- const getPoints = await program('./mandelbrot.bqn')
-
- const ctx = setupCanvas(200, 200)
- const points = getPoints(list([ctx.canvas.width, ctx.canvas.height]))
-
- // console.log(points)
- // debug(points)
-
- const imageDataRaw = points.flatMap((x) => (x.length === 4 ? x : [...x, 255]))
- const imageData = new ImageData(
- new Uint8ClampedArray(imageDataRaw),
- ctx.canvas.width,
- ctx.canvas.height
- )
- ctx.putImageData(imageData, 0, 0)
-
- console.log('DONE')
-}
-
-start().catch((e) => console.log(fmtErr(e)))