updates to patterns
authorbb3dan <github@bb3systems.com>
Fri, 18 Oct 2013 17:41:20 +0000 (10:41 -0700)
committerbb3dan <github@bb3systems.com>
Fri, 18 Oct 2013 17:41:20 +0000 (10:41 -0700)
DanHorwitz.pde
DanUtil.pde

index 8b84f3bd3c8d8a1bcdf35a70af539b371c2358a3..856c579a2e8ac7c7a14ce809b378abea3e4980d9 100644 (file)
@@ -411,8 +411,9 @@ class dCursor {
                dVertex v       = vCur;
 
                if (dDebug) {   p1 = v.getPoint(nFrom); float d = (p2 == null ? 0 : PointDist(p1,p2)); if (d>5) { println("too wide! quitting: " + d); exit(); }}
-                                                               for (int i = nFrom; i <= nTo; i++) { pat.getColors()[v.ci         + v.dir*i     ] = clr; }
+                                                               for (int i = nFrom; i <= nTo; i++) { pat.getColors()[v.ci          + v.dir*i     ] = clr; }
                if (v.same != null)             for (int i = nFrom; i <= nTo; i++) { pat.getColors()[v.same.ci + v.same.dir*i] = clr; }
+
                if (dDebug) {   p2 = v.getPoint(nTo); i2 = nTo; }
 
                pos += nMv; return nAmount - nMv;
@@ -436,15 +437,12 @@ class Worms extends SCPattern {
        private BasicParameter pEQ        = new BasicParameter("EQ"  ,  0);
        private BasicParameter pSpawn     = new BasicParameter("DIR" ,  0);
 
-       // versions of worms
-       // 5. slow worms branching out like a tree
-
        int     zMidLat = 82;
        float   nConfusion;
        private final Click moveChase = new Click(1000);
 
        xyz     middle;
-       int     AnimNum() { return floor(pSpawn.getValuef()*(3-.01)); }
+       int     AnimNum() { return floor(pSpawn.getValuef()*(4-.01)); }
        float   randX() { return random(model.xMax-model.xMin)+model.xMin; }
        float   randY() { return random(model.yMax-model.yMin)+model.yMin; }
        xyz     randEdge() { 
@@ -465,7 +463,7 @@ class Worms extends SCPattern {
                onParameterChanged(pEQ); setNewDest();
        }
 
-       public void onParameterChanged(LXParameter parameter) {
+       void onParameterChanged(LXParameter parameter) {
                nConfusion = 1-pConfusion.getValuef();
                for (int i=0; i<numCursors; i++) {
                        if (parameter==pSpawn) reset(cur.get(i));
@@ -480,14 +478,22 @@ class Worms extends SCPattern {
                                        c.setCur (lattice.getClosest(middle));
                                        break;
 
-                       case 1: c.clr = lx.hsb(135,0,100);                      // top to bottom
+                       case 1: c.clr = lx.hsb(135,0,100);                              // top to bottom
                                        float xLin = randX();
                                        c.setDest(lattice.getClosest(new xyz(xLin, 0         , zMidLat)).v, nConfusion);
                                        c.setCur (lattice.getClosest(new xyz(xLin, model.yMax, zMidLat)));
                                        break;
 
-                       case 2: c.clr = lx.hsb(300,0,100); break; // chase a point around
+                       case 2: c.clr = lx.hsb(300,0,100); break;               // chase a point around
+
+                       case 3: boolean bLeft = random(2)<1;
+                                       c.clr = lx.hsb(135+random(120),100,100);                                // sideways
+                                       float yLin = randX();
+                                       c.setDest(lattice.getClosest(new xyz(bLeft ? 0 : model.xMax,yLin,zMidLat)).v, nConfusion);
+                                       c.setCur (lattice.getClosest(new xyz(bLeft ? model.xMax : 0,yLin,zMidLat)));
+                                       break;
                }
+               if (pBlur.getValuef() == 1 && random(2)<1) c.clr = lx.hsb(0,0,0);
        }
 
        void setNewDest() {
@@ -504,15 +510,17 @@ class Worms extends SCPattern {
            if (moveChase.click()) setNewDest();
 
            float fBass=0, fTreble=0;
-           if (pEQ.getValuef()>0) {
+           if (pEQ.getValuef()>0) {            // EQ
                    eq.run(deltaMs);
                    fBass       = eq.getAverageLevel(0, 4);
                    fTreble = eq.getAverageLevel(eq.numBands-7, 7);
                }
 
-               for (int i=0,s=model.points.size(); i<s; i++) {
-                       color c = colors[i]; float b = brightness(c); 
-                       if (b>0) colors[i] = color(hue(c), saturation(c), (float)(b-100*deltaMs/(pBlur.getValuef()*TrailTime)));
+               if (pBlur.getValuef() < 1) {    // trails
+                       for (int i=0,s=model.points.size(); i<s; i++) {
+                               color c = colors[i]; float b = brightness(c); 
+                               if (b>0) colors[i] = color(hue(c), saturation(c), (float)(b-100*deltaMs/(pBlur.getValuef()*TrailTime)));
+                       }
                }
 
                int nWorms = floor(pWorms.getValuef() * numCursors * 
index e475059b3082937da86d867acd9ed2659cfd770d..6f4b0008485891d1a75ddbb05170d6c4e99cbc64 100644 (file)
@@ -431,6 +431,7 @@ class dLattice {
                        s.v1 = new dVertex(s,strip.points.get(15));
                        s.v0.setOpp(s.v1); s.v1.setOpp(s.v0);
                        if (col < NumBackTowers) DQ[col][row] = 16*floor((iTowerStrips-1)/16);
+                       else s.row=-1;
                }
 
                for (int j=0; j<iTowerStrips; j++) { for (int k=j+1; k<iTowerStrips; k++) {