xxxxxxxxxx
var ex, ey, eyeSize;
function setup() {
createCanvas(600, 600);
ex = width / 2;
ey = height / 2;
eyeSize = 100;
}
function draw() {
background(0);
noStroke();
drawEye (100,90);
drawEye (220,400);
drawEye (520,200);
}
function drawEye(ex, ey) {
var dy = mouseY - ey;
var dx = mouseX - ex;
var orientation = atan2(dy, dx);
push();
translate(ex, ey);
//white
fill(255);
strokeWeight(5);
circle(0, 0, eyeSize);
rotate(orientation);
//pupil
fill(0);
circle(eyeSize / 4, 0, eyeSize / 2);
pop();
}