X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=JackStahl.pde;h=862558ce21f90f5c3c9798cff8fdef5872453dc1;hb=09437b3e395227ad2061512f9f0333091aeef2b7;hp=05e2ec66e7c1ebdee6de1147ca31f60e87a11875;hpb=c681f4db55d0922b1bc84deb89e34f9b4f1cc8aa;p=SugarCubes.git diff --git a/JackStahl.pde b/JackStahl.pde index 05e2ec6..862558c 100644 --- a/JackStahl.pde +++ b/JackStahl.pde @@ -9,7 +9,7 @@ class Swim extends SCPattern { // Projection stuff - private final Projection projection; + private final LXProjection projection; SawLFO rotation = new SawLFO(0, TWO_PI, 19000); SinLFO yPos = new SinLFO(-25, 25, 12323); final BasicParameter xAngle = new BasicParameter("XANG", 0.9); @@ -20,7 +20,7 @@ class Swim extends SCPattern { public Swim(GLucose glucose) { super(glucose); - projection = new Projection(model); + projection = new LXProjection(model); addParameter(xAngle); addParameter(yAngle); @@ -34,7 +34,7 @@ class Swim extends SCPattern { int beat = 0; float prevRamp = 0; - void run(int deltaMs) { + void run(double deltaMs) { // Sync to the beat float ramp = (float)lx.tempo.ramp(); @@ -46,14 +46,14 @@ class Swim extends SCPattern { float denominator = max(xAngle.getValuef() + yAngle.getValuef() + zAngle.getValuef(), 1); - projection.reset(model) + projection.reset() // Swim around the world .rotate(rotation.getValuef(), xAngle.getValuef() / denominator, yAngle.getValuef() / denominator, zAngle.getValuef() / denominator) - .translateCenter(model, 0, 50 + yPos.getValuef(), 0); + .translateCenter(0, 50 + yPos.getValuef(), 0); float model_height = model.yMax - model.yMin; float model_width = model.xMax - model.xMin; - for (Coord p : projection) { + for (LXVector p : projection) { float x_percentage = (p.x - model.xMin)/model_width; // Multiply by 1.4 to shrink the size of the sin wave to be less than the height of the cubes. @@ -64,7 +64,7 @@ class Swim extends SCPattern { float v1 = sin_x > y_in_range ? (100 + 100*(y_in_range - sin_x)) : 0; float hue_color = (lx.getBaseHuef() + hueScale.getValuef() * (abs(p.x-model.xMax/2.)*.3 + abs(p.y-model.yMax/2)*.9 + abs(p.z - model.zMax/2.))) % 360; - colors[p.index] = color(hue_color, 70, v1); + colors[p.index] = lx.hsb(hue_color, 70, v1); } } } @@ -83,7 +83,7 @@ class Balance extends SCPattern { // Projection stuff - private final Projection projection; + private final LXProjection projection; SinLFO sphere1Z = new SinLFO(0, 0, 15323); SinLFO sphere2Z = new SinLFO(0, 0, 8323); @@ -102,7 +102,7 @@ class Balance extends SCPattern { public Balance(GLucose glucose) { super(glucose); - projection = new Projection(model); + projection = new LXProjection(model); addParameter(hueScale); addParameter(phaseParam); @@ -146,7 +146,7 @@ class Balance extends SCPattern { int beat = 0; float prevRamp = 0; - void run(int deltaMs) { + void run(double deltaMs) { // Sync to the beat float ramp = (float)lx.tempo.ramp(); @@ -157,12 +157,12 @@ class Balance extends SCPattern { float phase = phaseLFO.getValuef(); float crazy_factor = crazyParam.getValuef() / 0.2; - projection.reset(model) + projection.reset() .rotate(rotationZ.getValuef() * crazy_factor, 0, 1, 0) .rotate(rotationX.getValuef() * crazy_factor, 0, 0, 1) .rotate(rotationY.getValuef() * crazy_factor, 0, 1, 0); - for (Coord p : projection) { + for (LXVector p : projection) { float x_percentage = (p.x - model.xMin)/modelWidth; float y_in_range = heightMod.getValuef() * (2*p.y - model.yMax - model.yMin) / modelHeight; @@ -172,7 +172,7 @@ class Balance extends SCPattern { float v1 = max(0, 100 * (1 - 4*abs(sin_x - y_in_range))); float hue_color = (lx.getBaseHuef() + hueScale.getValuef() * (abs(p.x-model.xMax/2.) + abs(p.y-model.yMax/2)*.2 + abs(p.z - model.zMax/2.)*.5)) % 360; - color c = color(hue_color, 80, v1); + color c = lx.hsb(hue_color, 80, v1); // Now draw the spheres for (Sphere s : spheres) { @@ -197,7 +197,7 @@ class Balance extends SCPattern { float sphere_color = (lx.getBaseHuef() - (1 - hueScale.getValuef()) * d/r * 45) % 360; - c = blendColor(c, color((sphere_color + 270) % 360, 60, min(1, value) * 100), ADD); + c = blendColor(c, lx.hsb((sphere_color + 270) % 360, 60, min(1, value) * 100), ADD); } colors[p.index] = c; }