RangeError: Array buffer allocation failed at _generateGlobalPalette

Keep getting RangeError when saving the gif. Frames would be saved, but will get stuck in generating color palette (pic 1).
image
Here’s my code:

Here’s the error:

Would you mind posting the source code which demonstrates the problem instead of an image of part of the source code?

Hello! that is the whole code already, the only thing not there is the closing bracket hehe

It may have been a problem of computational capacity because when I decreased the slices, the gif was rendered :slight_smile:

Looking at it from the perspective of someone who is thinking about trying to help, if you post the source code and properly format it, all the reader has to do is hit the ‘copy’ button in the right upper corner and then paste the code into a p5.js editor. If you leave it as an image then the prospective helper has to type the entire source code into an editor; some folks aren’t willing to do that. You increase your chances of getting help if you post formatted source code.

I dropped the frame rate to 60 and it runs without error in p5.js web editor.

Here’s the source code that I used so others may try it:

let r = 100;
let a = 0;
let hori = 100;
let vert = 33;
let slice = 16;
let w = 400;
let h = 400;

function setup() {
  createCanvas(w, h);
  background(0);
  colorMode(HSB, 80);
  frameRate(60);
  saveGif("infinity_trail2", 6, []);
}

function draw() {
  background(0, 3);
  for (ang = 0; ang < 32 * PI + PI / slice; ang += PI / slice) {
    stroke(50, 10, 40, 20);
    strokeWeight(6);
    point(w / 2 + hori * cos(0.1 * ang), h / 2 + vert * sin(0.2 * ang));
  }
  stroke(40, 80, 80, 50);
  strokeWeight(8);
  point(w / 2 + hori * cos(0.1 * a), h / 2 + vert * sin(0.2 * a));
  a += PI / 64;
}

Addendum:
You probably already know this, but if you increase the value of ‘a’ from PI/64 to PI/6 it runs faster.

1 Like