import processing.core.*; import processing.opengl.*; import java.applet.*; import java.awt.*; import java.awt.image.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import java.util.zip.*; public class colors extends PApplet { int speed = 4; //pixels per Frame int breite = 8; int anzahl = 100; Stripe[] stripes = new Stripe[anzahl]; int colorNow = color(PApplet.parseInt(random(20,255)),PApplet.parseInt(random(20,255)), PApplet.parseInt(random(0,255))); int backgroundColor = color(0,0,0); boolean auto = false; int autoColor = color(PApplet.parseInt(random(20,255)),PApplet.parseInt(random(20,255)), PApplet.parseInt(random(0,255))); int nextFrame; int itemSpeed = 4; int itemPosition = 0; public void setup() { size(800, 300); background(0,0,0); fill(0, 153); noStroke(); frameRate(30); for (int i = 0; i = width-3){ colorNow = color(PApplet.parseInt(random(30,255)),PApplet.parseInt(random(30,255)), PApplet.parseInt(random(30,255))); } } public void mouseClicked() { nextFrame = frameCount + itemSpeed; auto = !auto; } class Stripe extends Vector{ int x; class Lamp { int c; int h; Lamp (int col, int hoehe){ c = col; h = hoehe; } } Stripe (int xpos){ x = xpos; } public void run(int 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)); } } public void update(){ for (int i = 0; i 0) { if (lamp.h < height) { fill(lamp.c, 5); rect(x, 0, breite, lamp.h*0.5f); }else if(lamp.h < height+255/5*speed*1.5f){ fill(lamp.c, 5); rect(x, 0, breite, height); }else { this.remove(i); } } } } } } static public void main(String args[]) { PApplet.main(new String[] { "colors" });}}