@@ -0,0 +1,1292 @@
+package com.haxademic.core.draw.image;%0A%0Aimport java.util.ArrayList;%0A%0Aimport com.haxademic.core.app.P;%0Aimport com.haxademic.core.constants.PRenderers;%0A%0Aimport processing.core.PGraphics;%0Aimport processing.core.PImage;%0A%0Apublic class ImageSequenceRecorder %7B%0A%0A%09protected int width;%0A%09protected int height;%0A%09protected int numFrames;%0A%09protected int frameIndex = 0;%0A%09protected ArrayList%3CPImage%3E images;%0A%09%0A%09public ImageSequenceRecorder(int width, int height, int frames) %7B%0A%09%09this.width = width;%0A%09%09this.height = height;%0A%09%09this.numFrames = frames;%0A%09%09buildFrames();%0A%09%7D%0A%09%0A%09protected void buildFrames() %7B%0A%09%09images = new ArrayList%3CPImage%3E();%0A%09%09for (int i = 0; i %3C numFrames; i++) %7B%0A%09%09%09images.add(P.p.createGraphics(width, height, PRenderers.P3D));%0A%09%09%7D%0A%09%7D%0A%09%0A%09public void addFrame(PImage img) %7B%0A%09%09ImageUtil.cropFillCopyImage(img, getNextBuffer(), true);%0A%09%7D%0A%09%0A%09protected PImage getNextBuffer() %7B%0A%09%09frameIndex = (frameIndex %3C numFrames) ? frameIndex + 1 : 0;%0A%09%09return images.get(frameIndex);%0A%09%7D%0A%09%0A%09protected void drawDebug(PGraphics pg) %7B%0A%09%09pg.beginDraw();%0A%09%09float frameW = (float) pg.width / (float) numFrames;%0A%09%09float frameH = frameW * ((float) width / (float) height);%0A%09%09for (int i = 0; i %3C numFrames; i++) %7B%0A%09%09%09float x = frameW * i;%0A%09%09%09pg.image(images.get(i), x, 0, frameW, frameH);%0A%09%09%7D%0A%09%09pg.endDraw();%0A%09%7D%0A%7D%0A

Add ImageSequenceRecorder