Created
September 8, 2013 21:17
-
-
Save tonussi/6488480 to your computer and use it in GitHub Desktop.
som.pde
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ddf.minim.*; | |
import ddf.minim.ugens.*; | |
Minim minim; | |
AudioOutput out; | |
Circle circle; | |
void setup() { | |
size(512, 200); | |
minim = new Minim(this); | |
out = minim.getLineOut(); | |
circle = new Circle(random(width), random(height)); | |
background(41); | |
} | |
void draw() { | |
fill(40, 40, 40, 10); | |
rect(0, 0, width, height); | |
fill(255, 10); | |
textSize(32); | |
text("click", width/2 - 25, height/2); | |
} | |
void mouseClicked() { | |
circle.update(mouseX, mouseY); | |
circle.display(); | |
circle.note(); | |
} | |
class Circle { | |
float x, y, r; | |
Circle(float x, float y) { | |
this.x = x; | |
this.y = y; | |
r = random(50, 100); | |
} | |
void display() { | |
noStroke(); | |
if (random(1) < .74352) | |
fill(180, random(50, 87), random(100, 140)); | |
else | |
fill(random(102, 200), 131, 180); | |
for (float fade = r; fade > 0; fade-=0.2) | |
ellipse(x, y, fade, fade); | |
} | |
void update(float x, float y) { | |
this.x = x; | |
this.y = y; | |
r = random(50, 100); | |
} | |
void note() { | |
out.playNote(this.r); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment