// Simple Real-Time Slit-Scan Program // Originally written by Neil Jenkins, 2004 // Small cleanups made by Golan Levin, 2005 // Written for Processing version 68. int video_width = 320; int video_height = 240; int video_fetch_loc = video_width/2; int window_width = 800; int window_height = video_height; int sample_width = 1; int draw_position = window_width - sample_width; // iterator boolean b_newFrame = false; // fresh-frame flag //-------------------------------------------- void setup(){ size(window_width, window_height); beginVideo(video_width, video_height, 30); background(0); } //-------------------------------------------- void videoEvent() { b_newFrame = true; } //-------------------------------------------- void loop() { if (b_newFrame) { replicate (video, video_fetch_loc, 0, video_fetch_loc+sample_width, video_height, draw_position + 0, 0, draw_position + sample_width, video_height); draw_position -= sample_width; if (draw_position < 0) { draw_position = window_width - sample_width; } b_newFrame = false; } }