float theta; PVector head,tail; Boolean dragging; ArrayList ALPHA_PLUSes; int centreHole; void setup(){ size(980,490); ALPHA_PLUSes = new ArrayList(); tail = new PVector(); head = new PVector(); dragging = true; } void draw(){ background(0); //draw nucleus pushMatrix(); translate(width/2,height/2); noStroke(); fill(100,0,255); ellipse(0,0,20,20); popMatrix(); //draw arrow if (dragging == true){ theta = atan2(head.x-tail.x,tail.y-head.y); stroke(255); line(tail.x,tail.y,head.x,head.y); pushMatrix(); translate(head.x,head.y); rotate(theta); line(0,0,10,10); line(0,0,-10,10); popMatrix(); } for (int i = ALPHA_PLUSes.size()-1; i>=0; i--) { ALPHA_PLUS OBJECT = (ALPHA_PLUS) ALPHA_PLUSes.get(i); OBJECT.move(); OBJECT.display(); OBJECT.show_trails(); } status("Frame Rate: "+str(round(frameRate))); } void mousePressed(){ tail = new PVector(mouseX,mouseY); head = new PVector(mouseX,mouseY); dragging = true; } void mouseDragged(){ head = new PVector(mouseX,mouseY); } void mouseReleased(){ head.sub(tail); head.div(40); dragging = false; ALPHA_PLUSes.add(new ALPHA_PLUS(tail,head)); }