int num = 20; int current = 0; int [] x = new int [num]; int [] y = new int [num]; int [] z = new int [num]; int [] a = new int [num]; int x1, y1, x2, y2; void setup(){ size(screen.width,screen.height); frameRate(30); x1 = width/2; y1 = height/2; for (int i = 0; i < num; i++){ x[i] = 0; y[i] = 0; z[i] = 0; a[i] = 0; } } void draw(){ background(255); for (int c = -width; c < width; c += 100){ for (int b = -height; b < height; b += 100){ x2 = mouseX; y2 = mouseY; line(c+x1,b+y1,c+x2,b+y2); for (int i = 0; i < num; i++){ line( c+x[i],b+y[i],c+z[i],b+a[i] ); } } } } void mousePressed(){ x[current]= x1 ; y[current]= y1; z[current]= mouseX ; a[current]= mouseY ; current++; if (current >= num){ current = 0; } x1 = x2; y1 = y2; if (mouseEvent.getClickCount()==2){ noLoop(); } } void keyPressed(){ if (key == 'n'){ loop(); } }