var x= 320;
var y= 240;
var d=200;
var ballR= 238;
var ballB= 135;
var ballG= 131;
var ball2=2;
var ball3=4;
function setup() {
createCanvas(640, 480);
}
function draw() {
background(232, 167, 0);
noStroke(0);
//eye
fill(255);
ellipse(x,y,2*d,2*d);
fill(ballR,ballB,ballG);
ellipse(x,y,d,d);
fill(ball2*ballR,ball2*ballB,ball2*ballG);
ellipse(x,y,d/3,d/3);
}
function mousePressed() {
if (dist(mouseX, mouseY, x, y) < d/2) {
ballG=random(50,250);
}
if (dist(mouseX, mouseY, x, y) < d/2) {
ballR=random(50.250);
}
if (dist(mouseX, mouseY, x, y) < d/2) {
ballB=random(50,250);
}
if (dist(mouseX, mouseY, x, y) < d/2) {
d=random(20,400);
}
if (dist(mouseX, mouseY, x, y) < d/2) {
x=(random(200,400));
}
if (dist(mouseX, mouseY, x, y) < d/2) {
y=(random(0,480));
}
}
Exploring randomizing color and position through mouse control while keeping an object in tact.