From: Arjun Banker Date: Fri, 23 Aug 2013 19:45:49 +0000 (-0700) Subject: arjun visuals X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0208d845a58e21b06271e685434006d89b9e5545;p=SugarCubes.git arjun visuals --- 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/SugarCubes.pde b/SugarCubes.pde index dac639a..6e2e986 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -77,6 +77,11 @@ LXPattern[] patterns(GLucose glucose) { // Sam new JazzRainbow(glucose), + // Arjun + new TelevisionStatic(glucose), + new AbstractPainting(glucose), + new Spirality(glucose), + // Basic test patterns for reference, not art new TestCubePattern(glucose), new TestTowerPattern(glucose), diff --git a/data/abstract.jpg b/data/abstract.jpg new file mode 100644 index 0000000..dc90da2 Binary files /dev/null and b/data/abstract.jpg differ