new mappings for Friday sep 20 video shoot
[SugarCubes.git] / AlexGreen.pde
index f73c26d28e9b9674659e890902974406f9ea4b78..ca032301ad5ea271fb99c5760aac390a50a914ee 100755 (executable)
@@ -1,11 +1,9 @@
 class SineSphere extends DPat {
   float modelrad = sqrt((model.xMax)*(model.xMax) + (model.yMax)*(model.yMax) + (model.zMax)*(model.zMax));
-  private final SinLFO rs = new SinLFO(0, 180, 5000);
-  private final SinLFO noisey = new SinLFO(modelrad/8.0, modelrad/4.0, 2300);
-  private final SinLFO band = new SinLFO (0, 10, 2000);
-  PVector modelcenter = new PVector(model.xMax, model.yMax, model.zMax);
-  BasicParameter widthparameter = new BasicParameter("Width", 10);
   
+  PVector modelcenter = new PVector(model.xMax, model.yMax, model.zMax);
+  public BasicParameter widthparameter = new BasicParameter("Width", .1);
+  public BasicParameter huespread = new BasicParameter("Hue", .5);
   
   class Sphery {
   float f1xcenter, f1ycenter, f1zcenter, f2xcenter, f2ycenter, f2zcenter;
@@ -14,6 +12,9 @@ class SineSphere extends DPat {
   private  SinLFO vx;
   float vibration_min, vibration_max, vperiod;
   
+  
+  float hsv = huespread.getValuef();
+  float wpv = widthparameter.getValuef();
   Sphery(float f1xcenter, float f1ycenter, float f1zcenter, float vibration_min, float vibration_max, float vperiod) {
    this.f1xcenter = f1xcenter;
    this.f1ycenter = f1ycenter;
@@ -22,12 +23,12 @@ class SineSphere extends DPat {
    this.vibration_max = vibration_max;
    this.vperiod = vperiod;
    addModulator( vibration = new SinLFO(vibration_min , vibration_max, vperiod)).trigger(); vibration.modulateDurationBy(vx);
-   addModulator( vx = new SinLFO(-1000, 1000, 10000)).trigger();
+   addModulator( vx = new SinLFO(-4000, 10000, 100000)).trigger();
  }
     float distfromcirclecenter(float px, float py, float pz, float f1x, float f1y, float f1z) {
    return dist(px, py, pz, f1x, f1y, f1z);
     }
+ //void updatespherey(deltaMs, )
  color spheryvalue (float px, float py, float pz , float f1xcenter, float f1ycenter, float f1zcenter) {
 
    return color(px, dist(px, py, pz, f1xcenter, f1ycenter, f1zcenter) , max(0, 100 - 10*abs(dist(px, py, pz, f1xcenter, f1ycenter, f1zcenter)- vibration.getValuef() ) ) ); 
@@ -37,6 +38,7 @@ class SineSphere extends DPat {
   void run(int deltaMS) {
     final float vv = vibration.getValuef();
     final float vvx = vx.getValuef();
+    
   }
   
   }
@@ -44,24 +46,21 @@ final int NUM_SPHERES = 5;
 final Sphery[] spherys;
   SineSphere(GLucose glucose) {
     super(glucose);
-    addModulator(rs).trigger();
-    //addModulator(band).trigger();
-    addModulator(noisey).trigger();
+   
     spherys = new Sphery[NUM_SPHERES];
     spherys[1] = new Sphery(model.xMax/4, model.yMax/2, model.zMax/2, modelrad/16, modelrad/8, 2500) ;    
     spherys[2] = new Sphery(.75*model.xMax, model.yMax/2, model.zMax/2, modelrad/20, modelrad/10, 2000);
+    spherys[3] = new Sphery(model.xMax/2, model.yMax/2, model.zMax/2, modelrad/4, modelrad/8, 2500);
+  
   }
 
 
-       float rsv, noiseyv, bandv;
 
     public void StartRun(int deltaMs) {
-               rsv = rs.getValuef();
-               noiseyv = noisey.getValuef();
-               bandv = band.getValuef();
-     
+               
                spherys[1].run(deltaMs);
                spherys[2].run(deltaMs);
+    spherys[3].run(deltaMs);
        }
 
        
@@ -71,16 +70,10 @@ final Sphery[] spherys;
       
       c = blendColor(c, spherys[2].spheryvalue(Px.x, Px.y, Px.z, .75*model.xMax, model.yMax/2, model.zMax/2), ADD);
       c = blendColor(c, spherys[1].spheryvalue(Px.x, Px.y, Px.z, model.xMax/4, model.yMax/4, model.zMax/2), ADD);
-      float distfromcenter = dist(Px.x, Px.y, Px.z, model.xMax/2, model.yMax/2, model.zMax/2);
-      int distint = floor(distfromcenter);
-      
-      c = blendColor(c, color(
+      c = blendColor(c, spherys[3].spheryvalue(Px.x, Px.y, Px.z, model.xMax/2, model.yMax/2, model.zMax/2),ADD);
       
-      constrain( Px.x  , 0, 360), 
-      constrain( distfromcenter, 20, 80), 
-      max(0, 100 - 10*abs(distfromcenter - noiseyv ) )
-      ),
-      ADD);
+
+  
       
         return c;
     }