-class WarmPlasma extends SCPattern {
+class GlitchPlasma extends SCPattern {
private int pos = 0;
private float satu = 100;
private float speed = 1;
BasicParameter speedParameter = new BasicParameter("SPEED", 0.1);
BasicParameter glitchParameter = new BasicParameter("GLITCH", 0.0);
- public WarmPlasma(GLucose glucose) {
+ public GlitchPlasma(GLucose glucose) {
super(glucose);
addParameter(saturationParameter);
addParameter(speedParameter);
if (parameter == saturationParameter) {
satu = 100*parameter.getValuef();
} else if (parameter == speedParameter) {
- speed = 10*parameter.getValuef();
+ speed = 8*parameter.getValuef();
} else if (parameter == glitchParameter) {
glitch = parameter.getValuef();
}
float bv = 100;
colors[p.index] = color((hv+2)*25, satu, bv);
}
- if (random(1.0)<glitch/10) {
- pos=pos-20;
+ if (random(1.0)<glitch/20) {
+ pos=pos-int(random(10,30));
}
pos+=speed;
if (pos >= MAX_INT-1) pos=0;
}
}
+class StripBounce extends SCPattern {
+ private final int numOsc = 30;
+ SinLFO[] fX = new SinLFO[numOsc]; //new SinLFO(0, model.xMax, 5000);
+ SinLFO[] fY = new SinLFO[numOsc]; //new SinLFO(0, model.yMax, 4000);
+ SinLFO[] fZ = new SinLFO[numOsc]; //new SinLFO(0, model.yMax, 3000);
+ SinLFO[] sat = new SinLFO[numOsc];
+ float[] colorOffset = new float[numOsc];
+
+ public StripBounce(GLucose glucose) {
+ super(glucose);
+ for (int i=0;i<numOsc;i++) {
+ fX[i] = new SinLFO(0, model.xMax, random(2000,20000));
+ fY[i] = new SinLFO(0, model.yMax, random(2000,20000));
+ fZ[i] = new SinLFO(0, model.zMax, random(2000,20000));
+ sat[i] = new SinLFO(60, 100, random(2000,50000));
+ addModulator(fX[i]).trigger();
+ addModulator(fY[i]).trigger();
+ addModulator(fZ[i]).trigger();
+ colorOffset[i]=random(0,100);
+ }
+ }
+
+ public void run(int deltaMs) {
+ float[] bright = new float[model.points.size()];
+ for (Strip strip : model.strips) {
+ for (int i=0;i<numOsc;i++) {
+ float avgdist=0.0;
+ avgdist = dist(strip.points.get(8).fx,strip.points.get(8).fy,strip.points.get(8).fz,fX[i].getValuef(),fY[i].getValuef(),fZ[i].getValuef());
+ boolean on = avgdist<30;
+ float hv = (lx.getBaseHuef()+colorOffset[i])%100;
+ float br = max(0,100-avgdist*4);
+ for (Point p : strip.points) {
+ if (on && br>bright[p.index]) {
+ colors[p.index] = color(hv,sat[i].getValuef(),br);
+ bright[p.index] = br;
+ }
+ }
+ }
+ }
+ for (Point p : model.points) {
+ if (bright[p.index]==0) {
+ colors[p.index]=color(0,0,0);
+ }
+ }
+ }
+}