L8on's life
[SugarCubes.git] / BenMorrow.pde
index 31c156b4ecf782734d4e621c763de80ba34e7bd2..51945a8de70b68902a180e0979a8996d43a43cbb 100644 (file)
@@ -1,5 +1,7 @@
 class TowerParams extends SCPattern
 {
+       BasicParameter hueoff = new BasicParameter("Hueoff", 0.0);
+       BasicParameter hueSpan = new BasicParameter("HueRange", 0.0);
        BasicParameter t1 = new BasicParameter("T1", 0.0);
        BasicParameter t2 = new BasicParameter("T2", 0.0);
        BasicParameter t3 = new BasicParameter("T3", 0.0);
@@ -19,10 +21,13 @@ class TowerParams extends SCPattern
 
        ArrayList<BasicParameter> towerParams;
        int towerSize;
+       int colorSpan;
        TowerParams(GLucose glucose) {
                super(glucose);
 
                towerParams = new ArrayList<BasicParameter>();
+               addParameter(hueoff);
+               addParameter(hueSpan);
                towerParams.add(t1);
                towerParams.add(t2);
                towerParams.add(t3);
@@ -44,21 +49,21 @@ class TowerParams extends SCPattern
                        addParameter(p);
                }
                towerSize = model.towers.size();
-               println("towers "+towerSize);
+               colorSpan = 255 / towerSize;
        }
 
-       void run(int deltaMs)
+       void run(double deltaMs)
        {
                clearALL();
                Tower t;
                for(int i=0; i<towerSize ;i++)
                {       
                        t= model.towers.get(i);
-                       for(Point p : t.points)
+                       for(LXPoint p : t.points)
                        {
                                if(p.y<towerParams.get(i).getValuef()*200)
                                {
-                                       colors[p.index]=color(70*i,255,255);
+                                       colors[p.index]=lx.hsb(255 * hueoff.getValuef()+colorSpan * hueSpan.getValuef() * i, 255, 255);
                                }
                        }
                }
@@ -67,7 +72,7 @@ class TowerParams extends SCPattern
 
        public void clearALL()
        {
-               for(Point p : model.points)
+               for(LXPoint p : model.points)
                {
                        colors[p.index] = 0;
                }
@@ -95,14 +100,14 @@ class Sandbox extends SCPattern
                println("towers "+towerrange);
        }
        
-       public void run(int deltaMs) {
+       public void run(double deltaMs) {
                
 
                if(counter % 10 ==0)
                {
                        doDraw(c,0);
                        c = (c + 1) % towerrange;
-                       long col = color(Math.round(Math.random()*255),255,255) ;
+                       long col = lx.hsb(Math.round(Math.random()*255),255,255) ;
                        doDraw(c,col);
                }
                counter++;
@@ -112,7 +117,7 @@ class Sandbox extends SCPattern
        public void doDraw(int c,long col)
        {
                        Tower t= model.towers.get((int) c);
-                       for(Point p : t.points)
+                       for(LXPoint p : t.points)
                        {
                                colors[p.index] = (int) col;
                        }
@@ -131,7 +136,7 @@ class GranimTestPattern extends GranimPattern
                getGraphicByName("myOtherColors").position=100;
        }
        int counter=0;
-       public void run(int deltaMs) 
+       public void run(double deltaMs) 
        {
                clearALL();
                super.run(deltaMs);
@@ -171,7 +176,7 @@ class GranimTestPattern2 extends GranimPattern
        }
        int counter=0;
        float count=0;
-       public void run(int deltaMs) 
+       public void run(double deltaMs) 
        {
                clearALL();
                super.run(deltaMs);
@@ -181,7 +186,7 @@ class GranimTestPattern2 extends GranimPattern
        }
        public void clearALL()
        {
-               for(Point p : model.points)
+               for(LXPoint p : model.points)
                {
                        colors[p.index] = 0;
                }
@@ -259,4 +264,4 @@ class DriveableCrossSections extends CrossSections
                }
        }
 
-}
\ No newline at end of file
+}