Image sweep takes an image as input and slices it into a small strip with repeating symmetry.
Create ofImage and ofxImageSweep
ofImage image;
ofImage positionMap;
ofxImageSweep sweep;
Load an image and initialize ofxImageSweep
void ofApp::setup(){
image.load("yourPic.jpg");
positionMap.load("map.jpg"); // A black and white image that controls the position in the x direction
sweep.allocate(ofGetWidth(),ofGetHeight());
}
In your update function
void ofApp::update(){
float divX = 6; // Amount of x slices
float divY = 6; // Amount of y slices
float posX = 100; // Scan position x
float posY = 100; // Scan position y
bool flipX = true; // Enable x symmetry
bool flipY = true; // Enable y symmetry
bool sliceX = true; // Enable x slice
bool sliceY = true; // Enable y slice
sweep.update(image.getTexture(), positionMap.getTexture(), divX, divY, posX, posY, flipX, flipY, sliceX, sliceY);
}
Draw the image
void ofApp::draw(){
sweep.draw(0, 0);
}
void ofApp::update(){
float speed = 6;
float position = ofGetElapsedTimef() * speed;
float divX = 6; // Amount of x slices
float divY = 6; // Amount of y slices
float posX = position; // Scan position x
float posY = position; // Scan position y
bool flipX = true; // Enable x symmetry
bool flipY = true; // Enable y symmetry
bool sliceX = true; // Enable x slice
bool sliceY = true; // Enable y slice
sweep.update(image.getTexture(), positionMap.getTexture(), divX, divY, posX, posY, flipX, flipY, sliceX, sliceY);