Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Printing to the console is quite slow. Be sure to comment any print() and println() cals in your code before presenting.
  • Optimise any graphic and videos so they are no bigger that absolutely necessary. 
  • Resizing images in real time is quite very slow. You can speed this up by resizing any images at the program start. See the example below. 
  • As a last resort, we can reduce the monitor resolution to speed things up 


Code Block
languagejava
titleResizing images
PImage bg;

void setup() {
  size(640, 360);

  bg = loadImage("image.jpg");
  bg.resize(width,height); // we rescale the image once here, instead of in the draw loop
}

void draw() {
  image(bg, 0, 0);
  // this is much faster than image.(bg, 0,0, width, height) which would rescales the graphics every frame
}

...

View file
nameTemplate.zip
height250


Exporting for flip book


Template with PDF export function. 


View file
nametemplatePDF.zip
height250


For exporting images the folowing code can be used (PDF doesn't work with 3D for example) :


Code Block
languagejava
titleResizing images
void setup() {  
	size(2100,2970,P3D); 
}
void draw() {
//code for exporting image on each frame  
   save("export/frame"+frameCount+".png");
  if (frameCount == 30) {
    exit();
  }
}