Help please! Need a couple hints!
in
Programming Questions
•
1 year ago
Hey people, im a bit stuck with a work for college... I need to make a program that prints in screen 3 random parts of the peoples faces. Ive managed to get it working till the random part, cause it only prints in order. The code as far as i have it is in the end. Plese help me, not only im a noob, but this is a very important work for my semester! Thanks in advance and sorry for the english, not my mother tongue :)
PImage imagen_01;
PImage imagen_02;
PImage imagen_03;
int posx = 0;
int posy = 0;
int ancho = 1920;
int alto = 360;
int azar =0;
String [] nombreImagen = {"ojos-0001.jpg","ojos-0002.jpg","ojos-0003.jpg","ojos-0004.jpg","ojos-0005.jpg","ojos-0006.jpg","ojos-0007.jpg","ojos-0008.jpg","ojos-0009.jpg","ojos-0010.jpg","ojos-0011.jpg","ojos-0012.jpg"};
void setup() {
size(1920, 1080);
println(nombreImagen);
azar = int(random(3));
println(azar);
//nombreImagen[].add = cargar imagen dinamicamente de la carpeta XXXXX;
imagen_01 = loadImage(nombreImagen[azar]); // Load the image into the program
imagen_02 = loadImage(nombreImagen[1]);
imagen_03 = loadImage(nombreImagen[2]);
noLoop(); // Makes draw() only run once
}
void draw() {
copy(imagen_01, 0, 0, 1920, 360, 0, 0, ancho, alto);
copy(imagen_02, 0, 360, 1920, 360, 0, 360, ancho, alto);
copy(imagen_03, 0, 720, 1920, 360, 0, 720, ancho, alto);
}
PImage imagen_01;
PImage imagen_02;
PImage imagen_03;
int posx = 0;
int posy = 0;
int ancho = 1920;
int alto = 360;
int azar =0;
String [] nombreImagen = {"ojos-0001.jpg","ojos-0002.jpg","ojos-0003.jpg","ojos-0004.jpg","ojos-0005.jpg","ojos-0006.jpg","ojos-0007.jpg","ojos-0008.jpg","ojos-0009.jpg","ojos-0010.jpg","ojos-0011.jpg","ojos-0012.jpg"};
void setup() {
size(1920, 1080);
println(nombreImagen);
azar = int(random(3));
println(azar);
//nombreImagen[].add = cargar imagen dinamicamente de la carpeta XXXXX;
imagen_01 = loadImage(nombreImagen[azar]); // Load the image into the program
imagen_02 = loadImage(nombreImagen[1]);
imagen_03 = loadImage(nombreImagen[2]);
noLoop(); // Makes draw() only run once
}
void draw() {
copy(imagen_01, 0, 0, 1920, 360, 0, 0, ancho, alto);
copy(imagen_02, 0, 360, 1920, 360, 0, 360, ancho, alto);
copy(imagen_03, 0, 720, 1920, 360, 0, 720, ancho, alto);
}
1