Remember that processing runs at 60 fps. This means that an integer, incrementing every frame will hit a multiple of 60 every 1 second.
60 (1s), 120 (2s), 180 (3s), ...
You may also use the global reserved variable frameCount which is an integer representing the amount of frames since your sketch has started.
Let's assume you want to loop 3 images, each for 1 second and then back to the first.
Using another variable as a timer also works, provided you keep track of the current frame you want to show.
You're going to have to maintain the state of your character, and at some point it will change.
For example, your character will be either: idle, moving, firing / action, ...
To keep this as simple as possible use a single integer to keep track and leave a comment for yourself.
There are 2 options for managing a list of frames for your character, an Array or an ArrayList. Since your character will most likely not add or remove any animation frames during your game, an ArrayList is not necessary.
For every animation of your character you will need to store a list of frames for that animation. We'll use arrays.
Notice how we are looping our frame at a rate of 60 / 5 which means 12 frames per second, which is pretty good for animation.
Also notice how we must check the state our character is in, is the character walking? shooting? or just standing there.
Make sure not to be loading the same frames for multiple instances of the same object. This will most likely incur a performance penalty.
Storing all arrays of frames inside an Animation class would be the preferred technique.
Then to access those frames it's simply a matter of calling
Not all animation requires frames, for example the arms of a clock rotate based on the time.
Regardless of the style of animation you decide to use, timers will be important in managing that animation.
Timers can be based on a custom integer, or reserver global variables like frameCount and millis()