Help: Loop/While with millis

Hi, i want to make an disco room and it has too keep chaning in the meanwhile you are there. i have it with millis but then i have to make a lot of codes

millis() is not complicated

Alternatively you can say frameRate(3); for example

int scene = 0;


//-------------------------------------------------------------------------

void setup() {

  size(1500, 900);//frame maat

  frameRate(30);
}

//---------------------------------------------------------------------------

void draw() {
  if (scene == 0) {
    tekenScene0();
  }
  if (scene == 1) {
    tekenScene1();
  }
}

void tekenScene0() {
  background(#EAD895); //is de muur
  fill(#E8E7E5); //kleur van de vloer
  noStroke(); //omleining van de vloer is weg
  quad(730, 546, 1503, 546, 1500, 900, 0, 900); //vorm van de vloer

  strokeWeight(1);
  stroke(#0300F2);
  line(732, 0, 730, 546);

  if (millis() > 0000) {
    fill(#c6a902, 60); //kleur raam (geel, disco)
  }
  if (millis() > 2000) {
    fill(#4deeea, 60); //kleur raam (blauw, disco)
  }
  if (millis() > 3000) {
    fill(#74ee15, 60); //kleur raam (groen, disco)
  }
  if (millis() > 4000) {
    fill(240, 0, 255, 60); //kleur raam (roze, disco)
  }
  if (millis() > 5000) {
    fill(0, 30, 255, 60); //kleur raam (paars, disco)
  }
  noStroke();
  square(0, 0, 1500);
}

void tekenScene1() {
  background(#030303);
  background(#4DBCFF); //is de muur
  fill(#E8E7E5); //kleur van de vloer
  noStroke(); //omleining van de vloer is weg
  quad(730, 546, 1503, 546, 1500, 900, 0, 900); //vorm van de vloer

  //sttoel links
  fill(#706f6f);
  quad(472, 568, 472, 707, 642, 707, 642, 568);
  fill(#575756);
  quad(420, 508, 420, 673, 486, 673, 481, 499);
  fill(#3c3c3b);
  quad(420, 590, 420, 729, 629, 729, 629, 590);

  //open haard
  fill(#3c3c3b);
  quad(917, 323, 917, 546, 1267, 546, 1267, 323);
  fill(#000000);
  rect(989, 402, 200, 130);



  //muurschilderijen
  fill(#AFAFAD);
  strokeWeight(3);
  stroke(#0300F2);
  ellipse(933, 118, 56, 123);
  fill(#08FFEC, 40);
  ellipse(1011, 84, 81, 54);
  fill(#08FF89, 40);
  ellipse(1011, 152, 81, 54);
  fill(#4808FF, 40);
  ellipse(1125, 119, 108, 108);
  fill(#FF08E3, 40);
  ellipse(1235, 118, 69, 123);

  //vloerkleed
  noStroke();
  fill(#366A66);
  ellipse(1020, 707, 608, 224);

  strokeWeight(1);
  stroke(#0300F2);
  line(732, 0, 730, 546);
}



//----------------------------------------------------------------------------------------------

void mousePressed() {
  // scene 0 -> 1
  if (mouseX > 285 && mouseX < (285+79) && mouseY > 520 && mouseY < (520+79) && scene == 0) {
    scene++;
  }
  if (scene>1) {
    scene=0;
  }

  // scene 0 -> 3
  if (mouseX > 110 && mouseX < (110+79) && mouseY > 327 && mouseY < (327+79) && scene == 0) {
    scene++;
  }
  if (scene>3) {
    scene=0;
  }

  //scene 1 -> 2
  if (mouseX > 35 && mouseX < (35+155) && mouseY > 715 && mouseY < (715+155) && scene == 1) {
    scene++;
  }
  if (scene>2) {
    scene=1;
  }
}

i got this but i dont get i really..
1 Like