We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello world.
I'm currently using this code to flicker through a folder of imagery in my data folder.
//declare and initialise variables
static final int BACKS = 4;
final PImage[] bgs = new PImage[BACKS];
void setup () {
size (1920, 1080);
frameRate (6); //Rate of flickering
smooth (4);
//load my imagery
for (int i = 0; i < BACKS; bgs[i] = loadImage("bg" + i++ + ".jpg"));
}
void draw () {
image(bgs[int(random(0, BACKS))], 0, 0, width, height);//Set a random Image - the size of the sketch
if ((keyPressed == true) && (keyCode == UP)) { //THIS IS WHAT STOPS THE LOOP
noLoop ();
}
}
When i press the UP key the looping stops, but is there a way i can press the UP key again for it to begin looping again?
Any help would be great!
Thanks - KOKO.
Answers
https://Processing.org/reference/keyPressed_.html
With this code, i receive the error : 'expecting EOF found 'if' over the line
if (k == UP)
do you have all }
line 26?
I do indeed mate, here's what i got.
after line 23 } instead of ;
Many thanks amigo's!