# P5js \[Violation\] 'requestAnimationFrame' handler took 75ms

**URL:** <https://discourse.processing.org/t/p5js-violation-requestanimationframe-handler-took-75ms/31976>\
**Category:** Coding Questions\
**Created:** [August 27, 2021, 8:36pm UTC](https://discourse.processing.org/t/p5js-violation-requestanimationframe-handler-took-75ms/31976 "2021-08-27T20:36:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![suecouzq](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@suecouzq](https://discourse.processing.org/u/suecouzq)\
**Post date:** [August 27, 2021, 8:36pm UTC](https://discourse.processing.org/t/p5js-violation-requestanimationframe-handler-took-75ms/31976/1 "2021-08-27T20:36:12Z")

</div>

I am getting this ‘requestAnimationFrame’ error with this code. I guess there’s something with the for loop that causes the problem but I can’t figure an alternative way of getting the same visual result. Any idea?

````auto
let zoff = 0;

function setup() {
  createCanvas(windowWidth, windowHeight);
  background(0);
}

function draw() {
  background(0);
  translate(width / 2, height / 2);
  scale(40);
  noStroke();
  fill(255);

  for (let a = 0; a < 7; a += 0.0012) {
    
    let x = cos(zoff) * 20 * sin(a);

    let y = cos(zoff+x/2) * 10 * cos(a);

    let e = cos(x) / sin(y) + zoff;

    circle(sin(e) * y, cos(e) * y, 0.091);
    
  }

  zoff += map(mouseX, 0, width, -0.03, +0.03);
}```
````

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [August 27, 2021, 8:48pm UTC](https://discourse.processing.org/t/p5js-violation-requestanimationframe-handler-took-75ms/31976/2 "2021-08-27T20:48:01Z")

</div>

I’m not able to replicate your error. When I run it, I don’t get “requestAnimationFrame” messages in the web editor console or in the browser javascript console.

https://editor.p5js.org/jeremydouglass/sketches/HE_OXMNbc

What is the exact message you are getting?

It might be a performance warning – the browser or computer not being able to step 7/.0012 = 5833 times each frame without falling behind your framerate, for example…

---

<div class="post-metadata">

**Author:** ![pirela](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@pirela](https://discourse.processing.org/u/pirela)\
**Post date:** [March 8, 2022, 10:23pm UTC](https://discourse.processing.org/t/p5js-violation-requestanimationframe-handler-took-75ms/31976/3 "2022-03-08T22:23:07Z")

</div>

As i get this error recently within a sketch, i went back to this forum and give my two cents :  
This is not an error but just an indication of performance.  
To get it, your console must be at the _all levels_ with _verboses_ checked.  
Otherwise , at standard level (debug or more) you can’t have the message.

In my case, it happens at the first draw (model(…)) of a rather heavy obj, but once in Webgl cache performance is ok. So, i don’t care and i come back to debug level…
