void setup() { frameRate(30); size(500,500); smooth(); noStroke(); } ArrayList ices = new ArrayList(); void draw() { background(100,100,200); fill(255,100); for(Ice i : ices){ i.grow(); i.draw(); } } float VAR = 0; void mousePressed(){ ices.add(new Ice(mouseX+random(-VAR,VAR),mouseY+random(-VAR,VAR))); } void mouseDragged(){ ices.add(new Ice(mouseX+random(-VAR,VAR),mouseY+random(-VAR,VAR))); } void reset(){ ices = new ArrayList(); } void keyPressed(){ if(key == ' ') reset(); } class Ice{ Ice(float px,float py){ ty = py; x = px; y = 0; } float ty; float x,y; void grow(){ if(y < ty) y+=ty/10; } void draw(){ float w = y / 20; // print(1); triangle(x-w,0,x+w,0,x,y); } }