aboutsummaryrefslogtreecommitdiff
path: root/sketches/week-1/script.js
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-10-29 20:20:25 +0530
committerAkshay Nair <phenax5@gmail.com>2023-10-29 20:20:25 +0530
commited50aedc08afd67b8d9606460d2d5209239ac88c (patch)
tree02264f19aaea8ea0b7c2287f5ae3910a0bd1486e /sketches/week-1/script.js
parentb6ebba87606d180735994d62e2d71c3fbf0b8763 (diff)
downloadcreative-coding-playground-ed50aedc08afd67b8d9606460d2d5209239ac88c.tar.gz
creative-coding-playground-ed50aedc08afd67b8d9606460d2d5209239ac88c.zip
chore: moving stuff around
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)))