summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Guschin <guschin.drew@gmail.com>2022-02-13 14:06:45 +0400
committerAndrew Guschin <guschin.drew@gmail.com>2022-02-13 14:06:45 +0400
commit3b8dcf9a84885d8708411092f6fc19f4a7e31349 (patch)
tree0aa99fddfbe0af21fc36f450f3657103973a8d81
parentb14a2cf250a2460fd7b3e71d229f72e628fdb556 (diff)
Added modulo sketchHEADmaster
-rw-r--r--index.html4
-rw-r--r--modulo.sketch.js37
2 files changed, 39 insertions, 2 deletions
diff --git a/index.html b/index.html
index 14288a8..e2f8ff7 100644
--- a/index.html
+++ b/index.html
@@ -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;
+}