Video Export (with unique Filename)

// Many thanks to Daan van der Zwaag!

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

int s = second();
int m = minute();

import com.hamoid.*;
VideoExport videoExport;

void rec() {
  if (frameCount == 1) {
    videoExport = new VideoExport(this, "./exports/"+sketchname+"_"+m+s+".mp4");
    videoExport.setFrameRate(30);  
    videoExport.startMovie();
  }
  videoExport.saveFrame();
}

Load Images from Folder

import java.io.File;
String [] imageFileNames;
ArrayList images;

void setup() {
  java.io.File folder = new java.io.File(dataPath("images"));
  imageFileNames = folder.list();
  images = new ArrayList<PImage>(); 

  println("loading...");
  // Load the image-files and push thems to imagess-arrayList
  for (int i = 0; i < imageFileNames.length; i++) {
    String filename = imageFileNames[i];
    if (filename.indexOf("Store") == -1) {
      PImage temp = loadImage("data/images/"+filename);
      images.add(temp);
    }
  }

  println(images.size() + " images loaded!");
}

Video Export (record when key is pressed)

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

import com.hamoid.*;
VideoExport videoExport;

boolean record = false;

void rec() {
  if (frameCount == 1) {
    videoExport = new VideoExport(this, "../"+sketchname+".mp4");
    videoExport.setFrameRate(30);  
    videoExport.startMovie();
  }
  if (keyPressed && key == 'r') {
    videoExport.saveFrame();
  }
}

Video Export (with Toggle)

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

import com.hamoid.*;
VideoExport videoExport;

boolean record = false;

void keyReleased() {
  if (key == 'r') {
    record = !record;
    println("recording:", record);
  }
}

void rec() {
  if (frameCount == 1) {
    videoExport = new VideoExport(this, "../"+sketchname+".mp4");
    videoExport.setFrameRate(30);  
    videoExport.startMovie();
  }
  if (record) {
    videoExport.saveFrame();
  }
}

Triangle

push();
translate(0,0);
float mag = 100;
triangle(0,-mag,mag,mag,-mag,mag);
pop();