Line 55: | Line 55: | ||
[https://vimeo.com/152994562 BeeGees Video Delay] | [https://vimeo.com/152994562 BeeGees Video Delay] | ||
// | |||
import processing.video.*; | |||
Movie myMovie; | |||
int maxFrames; | |||
int d = 4; | |||
boolean recording = false; | |||
ArrayList frames = new ArrayList(); | |||
void setup() { | |||
size(1280, 720); | |||
maxFrames = width / d; | |||
myMovie = new Movie(this, "NightFever.mp4"); | |||
myMovie.loop(); | |||
PImage img = createImage(width, height, RGB); | |||
frames.add(img); | |||
} | |||
void draw() { | |||
int n = frames.size(); | |||
image(myMovie, 0, 0); | |||
// iterate over vertical strips | |||
for(int i = 0; i < n; i++) { | |||
// get snip from the frame | |||
PImage img = (PImage) frames.get(i); | |||
// x coordinate for the left side of the current strip | |||
int x1 = int(map(i, 0, n-1, 0, width/2 - 100)); | |||
int y1 = int(map(i, 0, n-1, 0, height/2 - 100)); | |||
int x2 = width - x1; | |||
int y2 = height - y1; | |||
int w = x2 - y1; | |||
int h = y2 - y1; | |||
PImage snip = img.get(x1, y1, w, h); | |||
// show strip on screen | |||
//tint(255, 50); | |||
image(snip, x1, y1); | |||
} | |||
if(recording) { | |||
saveFrame("frame/####.png"); | |||
// recording feedback | |||
stroke(255, 0, 0); | |||
noFill(); | |||
strokeWeight(5); | |||
rect(0, 0, width, height); | |||
} | |||
} | |||
void keyPressed() { | |||
recording = !recording; | |||
} | |||
// Called every time a new frame is available to read | |||
void movieEvent(Movie m) { | |||
m.read(); | |||
PImage img = myMovie.get(); | |||
frames.add(img); | |||
if( frames.size() > maxFrames) { | |||
frames.remove(0); | |||
} | |||
} |
Revision as of 17:17, 25 January 2016
Josephine Jatzlau
homework 1
Kolibri
here is my first homework
didn't manage it to upload the code
homework 2
Moon
Moon 2.0
homework 3
Grumpy Cat Fusion
Pixel Sorting
Video Delay
// import processing.video.*; Movie myMovie; int maxFrames; int d = 4; boolean recording = false; ArrayList frames = new ArrayList();
void setup() {
size(1280, 720); maxFrames = width / d; myMovie = new Movie(this, "NightFever.mp4"); myMovie.loop(); PImage img = createImage(width, height, RGB); frames.add(img);
}
void draw() {
int n = frames.size(); image(myMovie, 0, 0); // iterate over vertical strips for(int i = 0; i < n; i++) { // get snip from the frame PImage img = (PImage) frames.get(i); // x coordinate for the left side of the current strip int x1 = int(map(i, 0, n-1, 0, width/2 - 100)); int y1 = int(map(i, 0, n-1, 0, height/2 - 100)); int x2 = width - x1; int y2 = height - y1; int w = x2 - y1; int h = y2 - y1; PImage snip = img.get(x1, y1, w, h); // show strip on screen //tint(255, 50); image(snip, x1, y1);
}
if(recording) {
saveFrame("frame/####.png"); // recording feedback stroke(255, 0, 0); noFill(); strokeWeight(5); rect(0, 0, width, height); }
}
void keyPressed() {
recording = !recording;
}
// Called every time a new frame is available to read
void movieEvent(Movie m) {
m.read(); PImage img = myMovie.get(); frames.add(img); if( frames.size() > maxFrames) { frames.remove(0); }
}