summaryrefslogtreecommitdiff
path: root/modulo.sketch.js
blob: a4b44484cc773feb0ea81d6903a601e775e4bedd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
let canvas_width = 500;
let canvas_height = 500;
let cell_size = 5;

let start = 0;

// let f = (x, y) =>
//     ((12212 * x * y + 8912 * x + 481 * y) % 271) < 135;

function f(x, y) {
    return ((12212 * x * y + 8912 * x + 481 * y) % 271);
}

function setup() {
    createCanvas(canvas_width, canvas_height);
}

function draw() {
    colorMode(HSL, 255, 100, 100);
    background(0);

    fill(0);
    noStroke();
    // square(0, 0, canvas_width / 20);
    for (let x = 0; x < canvas_width; x += 1) {
	for (let y = 0; y < canvas_height; y += 1) {
	    //     if (f(x, y)) set(x, y, color(255));
	    //     else set(x, y, color(0));
	    let val = f(x + start, y + start);
	    let col = color(val, 100, 50);
	    set(x, y, col);
	}
    }
    updatePixels();

    start += 1;
}