Hi, I am very new to processing and I am making a program based on a Coding Train Video. I have created an Eye Class that display’s an eye and then makes it blink. At the moment I can populate the scene with an array of eyes and have them all blink in unison . My problem is I want them to all blink at separate times and at separate speeds. I have played around with using the random() and delay() functions, but wherever I put them they cause all of the eyes to delay blinking, not just one
Main function (Eyeballs):
Eye[] eyes = new Eye[10];
void setup(){
  size(1000,1000);
  background(255);
  //smooth();
  //eye1 = new Eye();
  for(int i=0;i<eyes.length;i++){
    eyes[i] = new Eye();
  }
}
void draw(){
  background(0);
  translate(width/2,height/2);
  
  for(int i=0;i<eyes.length;i++){
    //delay((int)random(10,100);
    eyes[i].create();
    eyes[i].blink();
  }
  
}
Eye Class (Eye)
class Eye{
 float x,y;
 float blinkCnt,counter;
 float RightBtm,LeftBtm;
 float RightTop, LeftTop;
 float delay;
 float eyeWidth,eyeHeight,pupilWidth;
 
 Eye(){
   eyeWidth = 125; //100, 40
   eyeHeight = 50;
   pupilWidth = 0.875*eyeHeight;
   x = random(-width/2 + eyeWidth, width/2 - eyeWidth);
   y = random(-height/2 + eyeHeight,height/2 - eyeHeight);
   delay = 30; //random(10,60);
   blinkCnt = 0;
 }
  
 void create(){
   strokeWeight(5);
   fill(255,255,255);
   ellipse(x,y,eyeWidth,eyeHeight); //Outer Eye
  
   fill(0);
   ellipse(x,y,pupilWidth,pupilWidth); //Pupil
   
   //Top Eyelid Mapping
   RightTop = map(blinkCnt,0, delay, PI+HALF_PI, PI+PI);
   LeftTop = map(blinkCnt,0,delay, PI+HALF_PI, PI);
   
   //Bottom Eyelid Mapping
   RightBtm = map(blinkCnt, 0, delay, HALF_PI, 0);
   LeftBtm = map(blinkCnt, 0, delay, HALF_PI, PI);
   
   //Displaying Eyelids
   strokeWeight(0);
   fill(255,155,155);
   arc(x,y,eyeWidth,eyeHeight,LeftTop,RightTop,CHORD);
   arc(x,y,eyeWidth,eyeHeight,RightBtm,LeftBtm,CHORD);  
   
   
 }
 
 void blink(){
   //delay((int)random(delay));
   if(blinkCnt==0){
     counter = 1;
   }
   if(blinkCnt==delay){
     counter = -1;
   }
   blinkCnt += counter;
 }
}
            