import processing.opengl.*; int speed = 4; //pixels per Frame int breite = 8; int anzahl = 100; Stripe[] stripes = new Stripe[anzahl]; color colorNow = color(int(random(20,255)),int(random(20,255)), int(random(0,255))); color backgroundColor = color(0,0,0); boolean auto = false; color autoColor = color(int(random(20,255)),int(random(20,255)), int(random(0,255))); int nextFrame; int itemSpeed = 4; int itemPosition = 0; void setup() { size(800, 300); background(0,0,0); fill(0, 153); noStroke(); frameRate(30); for (int i = 0; i = width-3){ colorNow = color(int(random(30,255)),int(random(30,255)), int(random(30,255))); } } void mouseClicked() { nextFrame = frameCount + itemSpeed; auto = !auto; } class Stripe extends Vector{ int x; class Lamp { color c; int h; Lamp (color col, int hoehe){ c = col; h = hoehe; } } Stripe (int xpos){ x = xpos; } void run(color c) { if (!this.isEmpty()){ Lamp lamp = (Lamp)this.get(this.size()-1); if (lamp.c != c){ this.add(new Lamp(c,0)); }else { if (lamp.h > 30) { lamp.h -= 30; } } } else { this.add(new Lamp(c,0)); } } void update(){ for (int i = 0; i 0) { if (lamp.h < height) { fill(lamp.c, 5); rect(x, 0, breite, lamp.h*0.5); }else if(lamp.h < height+255/5*speed*1.5){ fill(lamp.c, 5); rect(x, 0, breite, height); }else { this.remove(i); } } } } } }