Hi Guys, I have a little troubleshooting with a PImage…
The code works but i really wonder how to change the direction of the pictures.
Starting mouseY on top with numb 22 going down to 0.
( I just managed to start the array with 0 going down to 22 ).
Since i tried the whole day to find the solution, i hope you could help me:
PImage[] images;
int numImg = 22;
void setup() {
background(255);
size(944, 944);
images = new PImage [numImg];
for (int a=0; a<numImg; a++) {
images[a] = loadImage("smile-" + a +".png" );
}
}
void draw() {
background(255);
int imgNr = int(map(mouseY, 0, width, 0, numImg));
translate(width/2, height/2);
imageMode(CENTER);
image(images[imgNr], 0, 0);
}
//All the best Iheartart
1 Like
kll
December 28, 2019, 1:00am
2
please format your code posting by pasting it into the
</> code button
of the editor header menu ( context name: Preformatted text )
it looks like
```
type or paste code here
```
also can use the ``` manually above and below your code.
thank you.
if you ask about the load Image sequence?
for (int a=0; a<numImg; a++) {
did you try ?
for (int a=numImg-1; a>=0; a--) {
Sorry, didn´t knew it.
The animation works with your variable aswell but it didn´t change the direction of the sequenz.
kll
December 28, 2019, 1:14am
4
iheartart:
Sorry, didn´t knew it
no problem, please edit your first post now. ( not make an new post for it )
please more detail about your question,
for (int a=0; a<numImg; a++) {
images[a] = loadImage(“smile-” + a +".png" );
}
possibly
for (int a=0; a<numImg; a++) {
images[numImg-1-a] = loadImage(“smile-” + a +".png" );
}
1 Like
It worked! Thanks for your advice !
I see, its the double subtraction whitch changes the direction, right ?
1 Like