# Why is a frameRate fucntion in setup slower than draw?

**URL:** <https://discourse.processing.org/t/why-is-a-framerate-fucntion-in-setup-slower-than-draw/33827>\
**Category:** Coding Questions\
**Created:** [November 30, 2021, 1:03am UTC](https://discourse.processing.org/t/why-is-a-framerate-fucntion-in-setup-slower-than-draw/33827 "2021-11-30T01:03:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![5star\_weapon](https://avatars.discourse-cdn.com/v4/letter/5/a4c791/32.png) [@5star\_weapon](https://discourse.processing.org/u/5star_weapon)\
**Post date:** [November 30, 2021, 1:03am UTC](https://discourse.processing.org/t/why-is-a-framerate-fucntion-in-setup-slower-than-draw/33827/1 "2021-11-30T01:03:38Z")

</div>

I wrote a code that moves sphere in 3d.

```auto
int s=100,m=5;//s is the size of the sphere, m is the position change.
void setup()
{
  size(500,500,P3D);
  noFill();//draw circle with only a stroke
}
void draw()
{
  background(128);
  translate(width/2+m++,height/2+m++,-100);//The position of the circle moves to lower right.
  sphere(s++);//perspective
  frameRate(10);//this is what i want to ask.
}

```

The code runs fine, and this sphere moves smoothly.  
But when I put frameRate in setup, like this code,

``` int s=100,m=5;//s is the size of the sphere, m is the position change. void setup() { size(500,500,P3D); noFill();//draw circle with only a stroke frameRate(10);//why does the sphere moves slowly? } void draw() { background(128); translate(width/2+m++,height/2+m++,-100);//The position of the circle moves to lower right. sphere(s++);//perspective } ``` It moves slower than frameRate in draw. Setup function execute frameRate once, but frameRate in setup is more slow. Why does this sphere move slower?
