/** * Line Breaking * by Xavier Gouchet (2009) * xavier.gouchet@gmail.com * http://www.xgouchet.fr/ */ ArrayList lines; float weight; void setup(){ size( 640,480); background(0); smooth(); lines = new ArrayList(); } void draw(){ weight = (2*cos(frameCount*0.1))+10; int count = lines.size(); for (int i=count-1; i>=0; i--){ Line l = (Line) lines.get(i); l.Move(); } } void mousePressed() { if (lines.size() == 0){ lines.add(new Line(random(width),random(height),(int)random(255))); } else { int count = lines.size(); for (int i=count-1; i>=0; i--){ Line l = (Line) lines.get(i); l.Event(); } } fill(0,0,0,4); rect(0,0,width,height); }