1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { png } from "https://esm.town/v/andreterron/png?v=10";
export let randomGenerator = png({
width: 256,
height: 256,
depth: 256,
}, (p) => {
const w = p.width, h = p.height;
for (let i = 0; i < 256; i++) {
p.color(i, i, i, 255);
}
for (let y = 0; y < h; y += 1) {
for (let x = 0; x < w; x += 1) {
let index = p.index(x, y);
let t = (y + x) / (w + h - 2);
p.buffer[index] = String.fromCharCode(Math.floor(Math.random() * 255));
}
}
});
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023