← Back

ofxImageSweep

github.com/skell999/ofxImageSweep · @skell999
OF 0.11 Graphics

Gpu based image effect

1 0 Last commit 6y ago Created 6y ago

README

ofxImageSweep

Image sweep takes an image as input and slices it into a small strip with repeating symmetry.

<img src="https://github.com/skell999/ofxImageSweep/blob/main/images/0.png" width="512" height="384" />

<img src="https://github.com/skell999/ofxImageSweep/blob/main/images/3.png" width="512" height="384" />

<img src="https://github.com/skell999/ofxImageSweep/blob/main/images/4.png" width="512" height="384" />

<img src="https://github.com/skell999/ofxImageSweep/blob/main/images/5.png" width="512" height="384" />

<img src="https://github.com/skell999/ofxImageSweep/blob/main/images/6.png" width="512" height="384" />

<img src="https://github.com/skell999/ofxImageSweep/blob/main/images/7.png" width="512" height="384" />

<img src="https://github.com/skell999/ofxImageSweep/blob/main/images/8.png" width="512" height="384" />

<img src="https://github.com/skell999/ofxImageSweep/blob/main/images/9.png" width="512" height="384" />

<img src="https://github.com/skell999/ofxImageSweep/blob/main/images/10.png" width="512" height="384" />

Basic usage



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);
}


Animation



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);

Get this addon

HTTPS
SSH