import ddf.minim.*; import ddf.minim.signals.*; AudioOutput out; sinePulse[] sine = new sinePulse[5]; Thing[] t = new Thing[5]; Ring[] r = new Ring [5]; sinePulse cello; Thing celloThing; Ring celloRing; Minim minim; boolean showVectors = false; int opacVal = 80; void setup() { size(400, 400); frameRate(30); smooth(); minim = new Minim(this); out = minim.getLineOut(Minim.STEREO, 2048); for(int i = 0; i<5; i++){ sine[i] = new sinePulse((200 * i+1), int(random(200, 600)), 1); t[i] = new Thing(new PVector(0.01,0.01),new PVector(0,0),new PVector(width/2, height/2)); r[i] = new Ring(); } cello = new sinePulse(200, int(random(500, 700)), 1); celloThing = new Thing(new PVector(0.01,0.01),new PVector(0,0),new PVector(width/2, height/2)); celloRing = new Ring(); } void draw() { background(100); for(int iter = 1; iter < 8; iter++){ ellipseMode(CENTER); fill(0,0); stroke(200,opacVal + iter * 20); strokeWeight(3); ellipse(width/2, height/2, iter * (width/7), iter * (width/7)); strokeWeight(1); } for(int i=0; i<5; i++){ t[i].go(); sine[i].changeCircle(t[i].circle); sine[i].pulse(); r[i].display(int(t[i].loc.x),int(t[i].loc.y)); if(sine[i].ring){ r[i].start(); sine[i].ring = false; } } if(cello.ring){celloRing.start(); cello.ring = false;} celloThing.render(); cello.pulse(); celloRing.display(int(celloThing.loc.x), int(celloThing.loc.y)); } void mousePressed(){ } // Renders a vector object 'v' as an arrow and a location 'loc' void drawVector(PVector v, PVector loc, float scayl) { pushMatrix(); float arrowsize = 4; // Translate to location to render vector translate(loc.x,loc.y); stroke(255); // Call vector heading function to get direction (note that pointing up is a heading of 0) and rotate rotate(v.heading2D()); // Calculate length of vector & scale it to be bigger or smaller if necessary float len = v.mag()*scayl; // Draw three lines to make an arrow (draw pointing up since we've rotate to the proper direction) line(0,0,len,0); line(len,0,len-arrowsize,+arrowsize/2); line(len,0,len-arrowsize,-arrowsize/2); popMatrix(); }