Merge branch 'processing-2'
authorMicah Elizabeth Scott <micah@scanlime.org>
Sat, 8 Mar 2014 03:47:42 +0000 (19:47 -0800)
committerMicah Elizabeth Scott <micah@scanlime.org>
Sat, 8 Mar 2014 03:47:42 +0000 (19:47 -0800)
DanKaminsky.pde
MicahScott.pde [new file with mode: 0644]
SugarCubes.pde

index cf77504f6db438c991e5146842dc5d1ab523e2fe..1005fe00e9e20ccd28279807b3e863332e8ad5f7 100644 (file)
@@ -26,6 +26,7 @@
 
 
 
+
 // OscP5 listener;
 // // Setup OSC
 // //listener = new OscP5(this,7022);
diff --git a/MicahScott.pde b/MicahScott.pde
new file mode 100644 (file)
index 0000000..0eb967b
--- /dev/null
@@ -0,0 +1,89 @@
+// Port of a pattern from Fadecandy. Micah Elizabeth Scott, November 2013.
+class Rings extends SCPattern {
+
+    float dx, dy, dz;
+    float angleParam, spacingParam;
+    float dzParam, centerParam;
+
+    BasicParameter pDepth = new BasicParameter("DEPTH", 0.6);
+    BasicParameter pBright = new BasicParameter("BRT", 0.75);    
+    BasicParameter pHue = new BasicParameter("HUE", 0.39);
+    BasicParameter pSaturation = new BasicParameter("SAT", 0.5);
+
+    BasicParameter pSpeed1 = new BasicParameter("SPD1", 0.2);
+    BasicParameter pSpeed2 = new BasicParameter("SPD2", 0.4);
+    BasicParameter pScale = new BasicParameter("SCALE", 0.15);
+
+    public Rings(LX lx) {
+        super(lx);
+        addParameter(pDepth);
+        addParameter(pBright);
+        addParameter(pHue);
+        addParameter(pSaturation);
+
+        addParameter(pSpeed1);
+        addParameter(pSpeed2);
+        addParameter(pScale);
+    }
+
+    public void run(double deltaMs) {
+
+        float xyspeed = pSpeed1.getValuef() * 0.01;
+        float zspeed = pSpeed1.getValuef() * 0.08;
+        float scale = pScale.getValuef() * 20.0;
+        float br = pBright.getValuef() * 3.0;
+        float gamma = 3.0;
+        float depth = 1.0 - pDepth.getValuef();
+        float hue = pHue.getValuef() * 360.0;
+        float saturation = pSaturation.getValuef() * 100;
+
+        float angleSpeed = pSpeed1.getValuef() * 0.002;
+        angleParam = (float)((angleParam + angleSpeed * deltaMs) % (2*PI));
+        float angle = sin(angleParam);
+
+        spacingParam += deltaMs * pSpeed2.getValuef() * 0.001;
+        dzParam += deltaMs * 0.000014;
+        centerParam += deltaMs * pSpeed2.getValuef() * 0.001;
+
+        float spacing = noise(spacingParam) * 50;
+
+        dx += cos(angle) * xyspeed;
+        dy += sin(angle) * xyspeed;
+        dz += (pow(noise(dzParam), 1.8) - 0.5) * zspeed;
+
+        float centerx = map(noise(centerParam, 100), 0, 1, -0.1, 1.1);
+        float centery = map(noise(centerParam, 200), 0, 1, -0.1, 1.1);
+        float centerz = map(noise(centerParam, 300), 0, 1, -0.1, 1.1);
+
+        float coordMin = min(model.xMin, min(model.yMin, model.zMin));
+        float coordMax = max(model.xMax, max(model.yMax, model.zMax));
+
+        for (LXPoint p : model.points) {
+
+            // Scale while preserving aspect ratio
+            float x = map(p.x, coordMin, coordMax, 0, 1);
+            float y = map(p.y, coordMin, coordMax, 0, 1);
+            float z = map(p.z, coordMin, coordMax, 0, 1);
+
+            float dist = sqrt(sq(x - centerx) + sq(y - centery) + sq(z - centerz));
+            float pulse = (sin(dz + dist * spacing) - 0.3) * 0.6;
+
+            noiseDetail(4);
+            float n = map(noise(dx + (x - centerx) * scale + centerx + pulse,
+                                dy + (y - centery) * scale + centery,
+                                dz + (z - centerz) * scale + centerz)
+                          - depth, 0, 1, 0, 2.0);
+            float m = map(noise(dx + (x - centerx) * scale + centerx,
+                                dy + (y - centery) * scale + centery,
+                                dz + (z - centerz) * scale + centerz),
+                          0, 1, 0, 300);
+            noiseDetail(1);
+
+            colors[p.index] = lx.hsb(
+                (hue + m) % 360.0,
+                saturation,
+                100 * constrain(pow(br * n, gamma), 0, 1.0)
+                );
+        }
+    }
+};
index b941bdbcc891ff3d38035917d69a1043afe82f34..9d72c5dfd49a6c0b2443d61e199ef611f82bca4c 100644 (file)
@@ -116,6 +116,9 @@ LXPattern[] patterns(LX lx) {
     new AbstractPainting(lx),
     new Spirality(lx),
 
+    // Micah
+    new Rings(lx),
+
     // Basic test patterns for reference, not art    
     new TestCubePattern(lx),
     new TestTowerPattern(lx),