Ok, so super new to processing and I am trying to figure out a project I would really love to get done. The idea is to have a looped animation projected(about 5 seconds), that changes when an AR marker is shown to an attached webcam. I'd like to have different animations for different markers I have the opencv for processing library installed and assume that is where to begin. I just don't know how to make it happen.
If it helps I have I have the code of the animation i am working with, which right now is controlled by A,W,S.:
int numFrames = 120;
PImage[] images = new PImage[numFrames];
PImage[] left = new PImage[numFrames];
int currentFrame = 0;
void setup(){
size(263, 410);
for (int i = 0; i < images.length; i++) {
String imageName = "Izquierda_idle_" + nf(i, 5) + ".png";
images[i] = loadImage(imageName);
}
frameRate(24);
}
void draw() {
image(images[currentFrame], 0, 0);
currentFrame++;
if(currentFrame >= images.length) {
currentFrame = 0;
}
if (keyPressed) {
if ((key =='a') || (key == 'A')){
for (int i = 0; i < images.length; i++) {
String imageName = "Izquierda_left_" + nf(i, 5) + ".png";
images[i] = loadImage(imageName);
}
println ("left pressed");
}
if ((key == 's') || (key == 'S')){
for (int b = 0; b < images.length; b++) {
String imageName = "Izquierda_right_" + nf(b, 5) + ".png";
images[b] = loadImage(imageName);
}
println ("right pressed");
}
if ((key == 'w') || (key == 'W')){
for (int w = 0; w < images.length; w++) {
String imageName = "Izquierda_idle_" + nf(w, 5) + ".png";
images[w] = loadImage(imageName);
}
println ("up pressed");
}
}
}
Thanks, Fern