Not sure why my array is not allowed to use a function (OOP)

Triangles tri1;

int savedTime;
float totalTime = 5000;
float black = 0;

void setup()
{
  size(900, 900);
  background(0);
  savedTime = millis();
  float x =25;
  float y =0;
  tri1 = new Triangles(x, y);
}

void draw()
{
  tri1.display();
}

class Triangles
{
  float x;
  float y;

  Triangles(float xpos, float ypos)
  {
    x = xpos;
    y = ypos;
  }


  void display()
  {
    color black = 0;
    fill(black);
     noStroke();
    float x;
    float y;
    for (x = 25; x < width; x+=50) {
      for (y = 0; y < height; y+=50) {
        int passedTime = millis() - savedTime;
        totalTime = random(0, 5000);
        if (passedTime > totalTime) {
         
          fill(black);
          triangle(x, y, x+25, y+50, x-25, y+50);
          black += 1;
          if (black == 255) {
            black = 0;
            savedTime = millis();
          }
        }
      }
    }
  }
}

okay i made some progress, thankyou for bearing with me, i’m aware its probably fustraiting when the solution is actually quite simple!