mooving back and forth in image sequence with noise
in
Programming Questions
•
8 months ago
here i have loop of 12 images, 0..12, 0..12
how do you change that it move forward then backwards?
i want to scrub through sequence with noise function
how do you change that it move forward then backwards?
i want to scrub through sequence with noise function
- int numFrames = 12; // The number of frames in the animation
int frame = 0;
PImage[] images = new PImage[numFrames];
void setup() {
size(640, 360);
frameRate(24);
for (int i = 0; i < numFrames; i++) {
String imageName = "PT_anim" + nf(i, 4) + ".gif";
images[i] = loadImage(imageName);
}
}
void draw() {
background(0);
frame = (frame+1) % numFrames; // Use % to cycle through frames
int offset = 0;
imageMode(CENTER);
image(images[(frame+offset) % numFrames], width/2, height/2);
offset+=1;
}
1