Exporting a .gif from Processing

import gifAnimation.*;
GifMaker gifExport;

final String sketchname = getClass().getName();

void setup() {
  size(128, 128);
  gifExport = new GifMaker(this, "../" + sketchname + ".gif", 5);
  gifExport.setRepeat(0); // make it an "endless" animation
}

void draw() {

  // Get creative
  
  gifExport.setDelay(1);
  gifExport.addFrame();
  if (frameCount == 128) {
    gifExport.finish();
    exit();
  }
}