Remove OSC references
[SugarCubes.git] / ArjunBanker.pde
... / ...
CommitLineData
1
2class TelevisionStatic extends SCPattern {
3 BasicParameter brightParameter = new BasicParameter("BRIGHT", 1.0);
4 BasicParameter saturationParameter = new BasicParameter("SAT", 1.0);
5 BasicParameter hueParameter = new BasicParameter("HUE", 1.0);
6 SinLFO direction = new SinLFO(0, 10, 3000);
7
8 public TelevisionStatic(LX lx) {
9 super(lx);
10 addModulator(direction).trigger();
11 addParameter(brightParameter);
12 addParameter(saturationParameter);
13 addParameter(hueParameter);
14 }
15
16 void run(double deltaMs) {
17 boolean d = direction.getValuef() > 5.0;
18 for (LXPoint p : model.points) {
19 colors[p.index] = lx.hsb((lx.getBaseHuef() + random(hueParameter.getValuef() * 360))%360, random(saturationParameter.getValuef() * 100), random(brightParameter.getValuef() * 100));
20 }
21 }
22}
23
24class AbstractPainting extends SCPattern {
25
26 PImage img;
27
28 SinLFO colorMod = new SinLFO(0, 360, 5000);
29 SinLFO brightMod = new SinLFO(0, model.zMax, 2000);
30
31 public AbstractPainting(LX lx) {
32 super(lx);
33 addModulator(colorMod).trigger();
34 addModulator(brightMod).trigger();
35
36 img = loadImage("abstract.jpg");
37 img.loadPixels();
38 }
39
40 void run(double deltaMs) {
41 for (LXPoint p : model.points) {
42 color c = img.get((int)((p.x / model.xMax) * img.width), img.height - (int)((p.y / model.yMax) * img.height));
43 colors[p.index] = lx.hsb(hue(c) + colorMod.getValuef()%360, saturation(c), brightness(c) - ((p.z - brightMod.getValuef())/p.z));
44 }
45 }
46}
47
48class Spirality extends SCPattern {
49 final BasicParameter r = new BasicParameter("RADIUS", 0.5);
50
51 float angle = 0;
52 float rad = 0;
53 int direction = 1;
54
55 Spirality(LX lx) {
56 super(lx);
57 addParameter(r);
58 for (LXPoint p : model.points) {
59 colors[p.index] = lx.hsb(0, 0, 0);
60 }
61 }
62
63 public void run(double deltaMs) {
64 angle += deltaMs * 0.007;
65 rad += deltaMs * .025 * direction;
66 float x = model.xMax / 2 + cos(angle) * rad;
67 float y = model.yMax / 2 + sin(angle) * rad;
68 for (LXPoint p : model.points) {
69 float b = dist(x,y,p.x,p.y);
70 if (b < 90) {
71 colors[p.index] = blendColor(
72 colors[p.index],
73 lx.hsb(lx.getBaseHuef() + 25, 10, map(b, 0, 10, 100, 0)),
74 ADD);
75 } else {
76 colors[p.index] = blendColor(
77 colors[p.index],
78 lx.hsb(25, 10, map(b, 0, 10, 0, 15)),
79 SUBTRACT);
80 }
81 }
82 if (rad > model.xMax / 2 || rad <= .001) {
83 direction *= -1;
84 }
85 }
86}
87
88
89
90