scale() jumps back to 100%
in
Contributed Library Questions
•
3 months ago
Hi all,
I'm trying to scale two sets of images while animating them. I load the images into arrays (using a separate class). A timer (guicomponents.GTimer lib) runs the function doAnimation() every 500 ms. This is the function:
I'm trying to scale two sets of images while animating them. I load the images into arrays (using a separate class). A timer (guicomponents.GTimer lib) runs the function doAnimation() every 500 ms. This is the function:
- void doAnimation(){
// scale current image
scale(0.66);
// draw the current image
image(imagesU[currentPosition], 0, 100);
image(imagesG[currentPosition], 400, 100);
println(currentPosition);
if(playing){
// move to the next image
currentPosition += 1;
// when you get to the end, loop
if(currentPosition >= imagesU.length)
{
currentPosition = 0;
}
// group
if(currentPosition >= imagesG.length)
{
currentPosition = 0;
}
}
The animation runs but the scaling doesn't always work. Every now and again one image isn't scaled but shown in its' original size. This happened with one set aswell as with two sets of images. The images are png images of 4-5 kb.
I hope someone has an idea what's going on here. Any help is greatly appreciated. Best, d
1