From: Alexander Kiselev Date: Sun, 8 Sep 2013 08:23:10 +0000 (-0700) Subject: Merge branch 'alexdesktopworking' of https://github.com/sugarcubes/SugarCubes into... X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d33c2d1d64234dd5f54942a9b76afaec3833c206;hp=e27a8652bec75b053fbc2a10d0757f0da7ca4766;p=SugarCubes.git Merge branch 'alexdesktopworking' of https://github.com/sugarcubes/SugarCubes into alexdesktopworking --- diff --git a/ArjunBanker.pde b/ArjunBanker.pde new file mode 100644 index 0000000..dcd5fae --- /dev/null +++ b/ArjunBanker.pde @@ -0,0 +1,90 @@ + +class TelevisionStatic extends SCPattern { + BasicParameter brightParameter = new BasicParameter("BRIGHT", 1.0); + BasicParameter saturationParameter = new BasicParameter("SAT", 1.0); + BasicParameter hueParameter = new BasicParameter("HUE", 1.0); + SinLFO direction = new SinLFO(0, 10, 3000); + + public TelevisionStatic(GLucose glucose) { + super(glucose); + addModulator(direction).trigger(); + addParameter(brightParameter); + addParameter(saturationParameter); + addParameter(hueParameter); + } + + void run(int deltaMs) { + boolean d = direction.getValuef() > 5.0; + for (Point p : model.points) { + colors[p.index] = color((lx.getBaseHuef() + random(hueParameter.getValuef() * 360))%360, random(saturationParameter.getValuef() * 100), random(brightParameter.getValuef() * 100)); + } + } +} + +class AbstractPainting extends SCPattern { + + PImage img; + + SinLFO colorMod = new SinLFO(0, 360, 5000); + SinLFO brightMod = new SinLFO(0, model.zMax, 2000); + + public AbstractPainting(GLucose glucose) { + super(glucose); + addModulator(colorMod).trigger(); + addModulator(brightMod).trigger(); + + img = loadImage("abstract.jpg"); + img.loadPixels(); + } + + void run(int deltaMs) { + for (Point p : model.points) { + color c = img.get((int)((p.x / model.xMax) * img.width), img.height - (int)((p.y / model.yMax) * img.height)); + colors[p.index] = color(hue(c) + colorMod.getValuef()%360, saturation(c), brightness(c) - ((p.fz - brightMod.getValuef())/p.fz)); + } + } +} + +class Spirality extends SCPattern { + final BasicParameter r = new BasicParameter("RADIUS", 0.5); + + float angle = 0; + float rad = 0; + int direction = 1; + + Spirality(GLucose glucose) { + super(glucose); + addParameter(r); + for (Point p : model.points) { + colors[p.index] = color(0, 0, 0); + } + } + + public void run(int deltaMs) { + angle += deltaMs * 0.007; + rad += deltaMs * .025 * direction; + float x = model.xMax / 2 + cos(angle) * rad; + float y = model.yMax / 2 + sin(angle) * rad; + for (Point p : model.points) { + float b = dist(x,y,p.fx,p.fy); + if (b < 90) { + colors[p.index] = blendColor( + colors[p.index], + color(lx.getBaseHuef() + 25, 10, map(b, 0, 10, 100, 0)), + ADD); + } else { + colors[p.index] = blendColor( + colors[p.index], + color(25, 10, map(b, 0, 10, 0, 15)), + SUBTRACT); + } + } + if (rad > model.xMax / 2 || rad <= .001) { + direction *= -1; + } + } +} + + + + diff --git a/BenMorrow.pde b/BenMorrow.pde index 9314c3c..87b22be 100755 --- a/BenMorrow.pde +++ b/BenMorrow.pde @@ -1,3 +1,85 @@ +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); + BasicParameter t4 = new BasicParameter("T4", 0.0); + BasicParameter t5 = new BasicParameter("T5", 0.0); + BasicParameter t6 = new BasicParameter("T6", 0.0); + BasicParameter t7 = new BasicParameter("T7", 0.0); + BasicParameter t8 = new BasicParameter("T8", 0.0); + BasicParameter t9 = new BasicParameter("T9", 0.0); + BasicParameter t10 = new BasicParameter("T10", 0.0); + BasicParameter t11 = new BasicParameter("T11", 0.0); + BasicParameter t12 = new BasicParameter("T12", 0.0); + BasicParameter t13 = new BasicParameter("T13", 0.0); + BasicParameter t14 = new BasicParameter("T14", 0.0); + BasicParameter t15 = new BasicParameter("T15", 0.0); + BasicParameter t16 = new BasicParameter("T16", 0.0); + + ArrayList towerParams; + int towerSize; + int colorSpan; + TowerParams(GLucose glucose) { + super(glucose); + + towerParams = new ArrayList(); + addParameter(hueoff); + addParameter(hueSpan); + towerParams.add(t1); + towerParams.add(t2); + towerParams.add(t3); + towerParams.add(t4); + towerParams.add(t5); + towerParams.add(t6); + towerParams.add(t7); + towerParams.add(t8); + towerParams.add(t9); + towerParams.add(t10); + towerParams.add(t11); + towerParams.add(t12); + towerParams.add(t13); + towerParams.add(t14); + towerParams.add(t15); + towerParams.add(t16); + for(BasicParameter p : towerParams) + { + addParameter(p); + } + towerSize = model.towers.size(); + colorSpan = 255 / towerSize; + println("towers "+towerSize); + } + + void run(int deltaMs) + { + clearALL(); + Tower t; + for(int i=0; i