Image question
in
Programming Questions
•
2 years ago
hi ppl,
I have to make a program that gives 20 images and we must criate a ellipse with 19 of them and the other show it in the middle like this
i already made the code but i can´t put them like the way i want..
the code
class SlideShow {
String dirImagens = sketchPath + "/Data/";
int nImagens = 20;
int pos;
int imgWidth = 300;
int cx = 300;
int cy = 250;
int rx = 50;
int ry = 100;
float angulo = 0.3306;
String[] lista;
void update(){
PImage[] Imag = new PImage[nImagens];
String[] s = listFileNames(dirImagens);
pos = int(random(nImagens));
for (int i=0; i<nImagens ; i++)
{
int ix = int(random(s.length));
PImage tempImagens = loadImage (dirImagens + s[ix]);
tempImagens.resize(imgWidth,0);
Imag[i]=tempImagens;
int xc=150; /* this part of the code is the one who make the ellipse, i have already try a lot of numbers and i can´t understand why the problem continues*/
int yc=125;
float x=(xc+rx*cos(angulo));
float y=(yc+ry*sin(angulo));
float posX=(x-(2*3.14)/100);
float posY=((2*3.14)/20);
image(Imag[i],posX,posY,Imag[i].width/6,Imag[i].height/6);
}
image(Imag[pos],cx,cy);
fill (200, 1, 1, 64);
ellipse (cx+150, cy+110, 200,200);//efeitoA
}
}
//void chooseEffect(){
//
//}
String[] listFileNames(String dir){
File ficheiro = new File(dir);
if(ficheiro.isDirectory())
{
String names[] = ficheiro.list();
return names;
}
else
{
return null;
}
}
String dirImagens = sketchPath + "/Data/";
int nImagens = 20;
int pos;
int imgWidth = 300;
int cx = 300;
int cy = 250;
int rx = 50;
int ry = 100;
float angulo = 0.3306;
String[] lista;
void update(){
PImage[] Imag = new PImage[nImagens];
String[] s = listFileNames(dirImagens);
pos = int(random(nImagens));
for (int i=0; i<nImagens ; i++)
{
int ix = int(random(s.length));
PImage tempImagens = loadImage (dirImagens + s[ix]);
tempImagens.resize(imgWidth,0);
Imag[i]=tempImagens;
int xc=150; /* this part of the code is the one who make the ellipse, i have already try a lot of numbers and i can´t understand why the problem continues*/
int yc=125;
float x=(xc+rx*cos(angulo));
float y=(yc+ry*sin(angulo));
float posX=(x-(2*3.14)/100);
float posY=((2*3.14)/20);
image(Imag[i],posX,posY,Imag[i].width/6,Imag[i].height/6);
}
image(Imag[pos],cx,cy);
fill (200, 1, 1, 64);
ellipse (cx+150, cy+110, 200,200);//efeitoA
}
}
//void chooseEffect(){
//
//}
String[] listFileNames(String dir){
File ficheiro = new File(dir);
if(ficheiro.isDirectory())
{
String names[] = ficheiro.list();
return names;
}
else
{
return null;
}
}
if someone could help i appreciate very much
sorry about my english i'm portuguese and my english
1