diff options
| -rw-r--r-- | index.html | 4 | ||||
| -rw-r--r-- | modulo.sketch.js | 37 |
2 files changed, 39 insertions, 2 deletions
@@ -13,7 +13,7 @@ </style> <script src="libs/p5.js"></script> <!-- <script src="libs/p5.sound.js"></script> --> - <script src="sketch.js"></script> + <script src="modulo.sketch.js"></script> </head> <body> @@ -21,4 +21,4 @@ </main> </body> -</html>
\ No newline at end of file +</html> diff --git a/modulo.sketch.js b/modulo.sketch.js new file mode 100644 index 0000000..a4b4448 --- /dev/null +++ b/modulo.sketch.js @@ -0,0 +1,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; +} |