Consequent Animations
in
Programming Questions
•
1 year ago
Hi all, I've been having a reaaally hard time trying to figure this out... so I'm working on a project with many different animations and I'm using the class given in the Processing examples and I've tried to modify it but failed:
boolean display(float xpos, float ypos) {
if (firstcall == true && frame != 0)
frame = -1;
frame = (frame+1) % imageCount;
if (frame == (imageCount-1))
{
image(images[frame], xpos, ypos);
firstcall = true;
return true;
}
image(images[frame], xpos, ypos);
firstcall = false;
return false;
}
The reason I made it return a boolean is to indicate the end of the animation so that I can switch from one animation to the next in my main class but it's still not working. Another issue I'm having is when I cut an animation halfway let's say and I invoke the same command again it starts off where it left last but I need it to start from the first frame again.
Someone please help =/
boolean display(float xpos, float ypos) {
if (firstcall == true && frame != 0)
frame = -1;
frame = (frame+1) % imageCount;
if (frame == (imageCount-1))
{
image(images[frame], xpos, ypos);
firstcall = true;
return true;
}
image(images[frame], xpos, ypos);
firstcall = false;
return false;
}
The reason I made it return a boolean is to indicate the end of the animation so that I can switch from one animation to the next in my main class but it's still not working. Another issue I'm having is when I cut an animation halfway let's say and I invoke the same command again it starts off where it left last but I need it to start from the first frame again.
Someone please help =/
1