aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.norg8
-rw-r--r--justfile2
-rw-r--r--sketches/04/polka.frag37
3 files changed, 46 insertions, 1 deletions
diff --git a/TODO.norg b/TODO.norg
index 7ee42aa..28d69d4 100644
--- a/TODO.norg
+++ b/TODO.norg
@@ -1,5 +1,8 @@
* Week
- - ( ) Mandelbrot | BQN
+ - (x) Mandelbrot | BQN + Glsl
+ - (x) Newton's fractals | Glsl
+ - ( ) Flow | Glsl
+ - ( ) {http://quil.info/sketches/local/04058d1f6e2628d8c71b4fd7c850b8937c0d12b8c48cfb2383b24fbdf41ae8c1} | Glsl
* Ideas
- Flow fields on image
@@ -17,7 +20,10 @@
- HTML5 canvas
- p5.js
- Uiua
+ - {https://github.com/sleexyz/hylogen}
+ - Clojure {http://quil.info/}
- Desmos
+ - Desmos 3D
- Processing
- webgl shaders
- X11 (Xlib)
diff --git a/justfile b/justfile
index c17f264..2d1f299 100644
--- a/justfile
+++ b/justfile
@@ -4,6 +4,8 @@ sketch name *args:
s1: (sketch "01" "glslViewer" "mandelbrot.frag")
s1_bqn: (sketch "01" "live-server" "--port=3000" "--no-browser" ".")
s2: (sketch "02" "glslViewer" "newton.frag")
+s3: (sketch "03" "glslViewer" "flow.frag" "-testImage" "test.png")
+s4: (sketch "04" "glslViewer" "polka.frag")
# week1:
diff --git a/sketches/04/polka.frag b/sketches/04/polka.frag
new file mode 100644
index 0000000..1a93292
--- /dev/null
+++ b/sketches/04/polka.frag
@@ -0,0 +1,37 @@
+varying vec4 v_position;
+uniform vec2 u_resolution;
+uniform float u_time;
+
+#define MAX_ITERATIONS 100
+#define DOTS 32.
+
+void main() {
+ float time = u_time * 2.;
+
+ float ratio = u_resolution.x / u_resolution.y;
+ vec2 pos = v_position.xy/vec2(1.0, ratio);
+
+ gl_FragColor = vec4(0., 0., 0., 1.);
+
+ float segment = 2.0 / (DOTS + 1.);
+
+ for (float i = 0.; i < DOTS; i++) {
+ for (float j = 0.; j < DOTS; j++) {
+ int alt = int(mod(i + j, 2.));
+ vec2 step = vec2(segment * (i + 1.0), segment * (j + 1.0));
+ float radius = (sin(time - length(pos)) + 1.)*0.02;
+ if (alt == 0) {
+ radius = (0.04 - radius);
+ }
+
+ if (length(pos - 1. + step) < radius) {
+ if (alt == 0) {
+ gl_FragColor = vec4(.17, .24, .31, 1.);
+ } else {
+ gl_FragColor = vec4(0.75, 0.22, 0.17, 1.);
+ }
+ }
+ }
+ }
+}
+