Object follows mouse :: Processing
- Started
- Last post
- 9 Responses
- CyBrain0
Here's how ignorant I am. I didn't know Processing could be interactive.
- CyBrain0
Here's an example. Maybe you checked here first.
http://processing.org/learning/t…
- CyBrain0
And I guess people who work with Processing can hate Steve Jobs along with us Flash people.
- monNom0
^ but processing can run (like a dog) in browsers with javascript, no plugins necessary :)
fixed it for you.
- acescence0
hey thanks champ
- acescence0
d1 is never less than 30
- acescence0
the math to constrain it to a circle is beyond me, but if you take out the check if d1<30 it sort of works
void setup() {
size(400, 400);
smooth();
}void draw() {
background(27);
noStroke();
eye(200, 200, 50, 50);
}void eye( float posX, float posY, int x, int y) {
float d1 = dist(posX, posY, 15, 15);
float mx = constrain(mouseX, posX - 15, posX + 15);
float my = constrain(mouseY, posY - 15, posY + 15);
fill(13);
ellipse(posX, posY, x * 2, y * 2);
fill(255);
ellipse(posX, posY, x * 2 - 10, y * 2 - 10);strokeWeight(2);
stroke(0, 255, 255);
fill(20, 200, 175);
ellipse(mx, my, x, y);
fill(0);
stroke(10, 100, 205);
ellipse(mx, my, x/2, y/2);
fill(255, 90);
noStroke();
ellipse(mx - (x/4), my - (y/4), x/3, y/3);}
- acescence0
^ but processing can run in browsers with javascript, no plugins necessary :)