P5js [Violation] 'requestAnimationFrame' handler took 75ms

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?

let zoff = 0;

function setup() {
  createCanvas(windowWidth, windowHeight);

function draw() {
  translate(width / 2, height / 2);

  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);

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.

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…

1 Like

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…