Different frameCount in the same code

Hello, guys! I’m Cosmin and is a pleasure to be here. I have a question: it’s possible to have different frameCounts in the same definition? More exactly, I have two videos with different value of this function. In the first one, the frameCounts are 3, and for the second one the value is 30. I want to put this configurations together in the same code. It can be possible to do that and where should I put a more attention? Thank you in advance!

1st. color bg=0;
color bdy=#f1f1f1;

void setup() {
size(900, 900, P2D);
surface.setLocation(1920, 0);
frameRate(3);
}

void draw() {
background(bg);
noFill();
rectMode(CENTER);
ellipseMode(CENTER);

float a=400;
float r=250;
float b=r/14;

pushMatrix();
translate(random(a/2, width-(a/2)), random(a/2, height-(a/2)));
rotate(random(0, 2*PI));
//noFill();
//noStroke;
stroke(bdy);
strokeWeight(5);
fill(bg);
rect(0, 0, r, r);
popMatrix();

push();
translate(random(a/2, width-(a/2)), random(a/2, height-(a/2)));
rotate(random(0, 2*PI));
//noFill();
//noStroke();
stroke(bdy);
fill(bg);
strokeWeight(5);
ellipse(0, 0, r, r);
pop();

push();
translate(random(a, width-a), random(a, height-a));
rotate(random(0, 2PI));
//noFill();
noStroke();
stroke(bdy);
strokeWeight(5);
fill(bg);
beginShape();
vertex(0+b, 0+b+0.5
b);
vertex(r/2+b, r);
vertex(-r/2+b, r);
endShape(CLOSE);
pop();
}

2nd

color bg=0;
color bdy=#f1f1f1;
float lx = 10;
float ly = 15;
PShape noise_1;
PShape noise_2;
PShape noise_3;

void setup() {
size(900, 900, P2D);
surface.setLocation(1920, 0);
frameRate(30);
noise_1 = loadShape(“noise_1.svg”);
noise_2 = loadShape(“noise_2.svg”);
noise_3 = loadShape(“noise_3.svg”);
}

void draw() {
background(bg);
fill(bdy);
ellipse(random(0, width-lx), random(0, height-ly), random(1, lx), random(1, ly));
rect(random(0, width-lx), random(0, height-ly), random(1, lx), random(1, ly));
noise_1.disableStyle();
noise_2.disableStyle();
noise_3.disableStyle();
noStroke();
shape(noise_1, random(0, width), random(0, height), random(5, 40), random(10, 20));
shape(noise_2, random(0, width), random(0, height), random(5, 50), random(10, 20));
shape(noise_3, random(0, width), random(0, height), random(5, 60), random(10, 20));
}

Hello,

No. You can use the frameCount and perform operations on it.

There are resources here:

Look up the references for:

  • frameCount()
  • frameRate()

It is not clear what you are asking.

Example using frameCount with a fixed frameRate:

void setup() 
  {
  frameRate(60);  //This is the default
  println(frameCount, sec);	
  }

void draw() 
  { 
  sec = frameCount%60;
  if(sec == 0) 
    {
    println(frameCount, sec, count);
	  count++;
    }
  }

Please format your code:
https://discourse.processing.org/faq#format-your-code

:)

Thank you for your answer! I will check right now. :slight_smile: