Line head; Line body; void setup(){ size(650,750); background(255); frameRate(20); head = new Line (0, 0); body = new Line (10, 10); } void draw(){ head.drawing(); body.drawing(); } void mousePressed(){ noLoop(); } void keyPressed(){ background(255); loop(); } class Line{ float x, y; float a, b; float xx, yy; float ranx; float rany; int life; Line (float posx, float posy){ a = width/2; b = height/2.3; x = posx; y = posy; ranx = 1; rany = 1; } void drawing(){ xx = x; yy = y; x+= ranx; y+= rany; ranx += random(-10,10)*0.08; rany += random(-10,11)*0.08; stroke(0,50); strokeWeight(random(0,2)); line(a+xx,b+yy,a+x,b+y); line(a-xx,b+yy,a-x,b+y); life++; if (life>65){ float t = random(100); x = 25*sin(t); y = 60*cos(t+10); xx = 0; yy = 0; ranx = 0; rany = 0; life = 0; } } }