// Dartmouth CS 2, Winter 2009, Chris Bailey-Kellogg // Notes 19 | Sketch 5 // Uses movie file from Processing example Libraries | Video (Movie) | Loop import processing.video.*; Movie station; int szx=40,szy=30; // how big to draw the frames int nx,ny; // number of frames across and down (computed in setup) int x=0,y=0; // current frame index on frame grid void setup() { size(800,600); nx = width/szx; ny = height/szy; station = new Movie(this, "station.mov"); station.loop(); } void draw() { if (station.available()) { // a movie frame is available for reading station.read(); // read it // draw it at the current position image(station,x*szx,y*szy,szx,szy); // advance the position, wrapping around in x and y x++; if (x==nx) { x=0; y++; if (y==ny) y=0; } } }