# Different frameCount in the same code

**URL:** https://discourse.processing.org/t/different-framecount-in-the-same-code/33937
**Category:** Coding Questions
**Tags:** homework
**Created:** [December 5, 2021, 4:03am UTC](https://discourse.processing.org/t/different-framecount-in-the-same-code/33937 "2021-12-05T04:03:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Cosmin](https://avatars.discourse-cdn.com/v4/letter/c/54ee81/32.png) [@Cosmin](https://discourse.processing.org/u/Cosmin)
#### Post date: [December 5, 2021, 4:03am UTC](https://discourse.processing.org/t/different-framecount-in-the-same-code/33937/1 "2021-12-05T04:03:52Z")

</div>

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, 2_PI));  
//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));  
}

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [December 5, 2021, 11:07am UTC](https://discourse.processing.org/t/different-framecount-in-the-same-code/33937/2 "2021-12-05T11:07:32Z")

</div>

Hello,

> [@Cosmin](#):
>
> it’s possible to have different frameCounts in the same definition?

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

There are resources here:

> **[Welcome to Processing!](https://processing.org)**
>
> Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology…

Look up the references for:

- _frameCount()_
- _frameRate()_

It is not clear what you are asking.

Example using frameCount with a fixed frameRate:

```auto
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](https://discourse.processing.org/faq#format-your-code)

`:)`

---

<div class="post-metadata">

### Author: ![Cosmin](https://avatars.discourse-cdn.com/v4/letter/c/54ee81/32.png) [@Cosmin](https://discourse.processing.org/u/Cosmin)
#### Post date: [December 6, 2021, 4:03am UTC](https://discourse.processing.org/t/different-framecount-in-the-same-code/33937/3 "2021-12-06T04:03:30Z")

</div>

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