I've made a simple Three.js animated scene which exports a GLB file successfully, and I'm now attempting to include the option to export a GIF of the object. I'm using the omggif repository. I'm getting a 'Invalid code/color length, must be power of 2 and 2 .. 256.' error, and when I log the palette array it's empty. So I presume the problem is more that I'm passing something in incorrectly. I don't know if deciphering this would be easier than finding another option. Any suggestions or guidance would be appreciated.
var palette = opts.palette;
if (palette === undefined || palette === null) {
using_local_palette = false;
palette = global_palette;
}
if (palette === undefined || palette === null)
throw new Error("Must supply either a local or global palette.");
var num_colors = check_palette_and_num_colors(palette);
function check_palette_and_num_colors(palette) {
var num_colors = palette.length;
if (num_colors < 2 || num_colors > 256 || num_colors & (num_colors-1)) {
throw new Error(
"Invalid code/color length, must be power of 2 and 2 .. 256.");
}
return num_colors;
}