X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=BenMorrow.pde;h=9314c3ce44318661de3af7095c8b0eaa48a259a3;hb=2f1840a64de3f7d3ca1a51693db9c049a8924d1d;hp=911f886fef8661075837c690aa78f4ef0320d9b9;hpb=3b85aef48bc63012831ae3f47405a299b1139e87;p=SugarCubes.git diff --git a/BenMorrow.pde b/BenMorrow.pde old mode 100644 new mode 100755 index 911f886..9314c3c --- a/BenMorrow.pde +++ b/BenMorrow.pde @@ -70,9 +70,9 @@ class GranimTestPattern extends GranimPattern } public void clearALL() { - for(Point p : model.points) + for(int i = 0; i < colors.length; i++) { - colors[p.index] = 0; + colors[i] = 0; } } @@ -101,7 +101,7 @@ class GranimTestPattern2 extends GranimPattern super.run(deltaMs); Graphic randomsGraphic = getGraphicByName("myRandoms"); randomsGraphic.position = Math.round(sin(count)*1000)+5000; - count+= 0.0005; + count+= 0.005; } public void clearALL() { @@ -112,4 +112,75 @@ class GranimTestPattern2 extends GranimPattern } -} \ No newline at end of file +}; + +class DriveableCrossSections extends CrossSections +{ + BasicParameter xd; + BasicParameter yd; + BasicParameter zd; + BasicParameter mode; + + DriveableCrossSections(GLucose glucose) { + super(glucose); + } + + public void addParams() + { + mode = new BasicParameter("Mode", 0.0); + xd = new BasicParameter("XD", 0.0); + yd = new BasicParameter("YD", 0.0); + zd = new BasicParameter("ZD", 0.0); + addParameter(mode); + addParameter(xd); + addParameter(yd); + addParameter(zd); + + super.addParams(); + } + + public void onParameterChanged(LXParameter p) { + if(p == mode) + { + if(interactive()) + { + copyValuesToKnobs(); + }else{ + copyKnobsToValues(); + } + } + } + + void copyValuesToKnobs() + { + xd.setValue(x.getValue()/200); + yd.setValue(y.getValue()/115); + zd.setValue(z.getValue()/100); + } + + void copyKnobsToValues() + { + x.setValue(xd.getValue()*200); + y.setValue(yd.getValue()*115); + z.setValue(zd.getValue()*100); + } + + boolean interactive() + { + return Math.round(mode.getValuef())>0.5; + } + + public void updateXYZVals() + { + if(interactive()) + { + xv = xd.getValuef()*200; + yv = yd.getValuef()*115; + zv = zd.getValuef()*100; + }else{ + super.updateXYZVals(); + copyValuesToKnobs(); + } + } + +}