code: private void nextFrame(long delta) {
  		if (stopped) {
  			return;
  		}
  		if (frames.size() == 0) {
  			return;
  		}
  		
  		nextChange -= delta;
  		
  		while (nextChange < 0 && (!stopped)) {
  			if (currentFrame == stopAt) {
  				stopped = true;
  				break;
  			}
  			if ((currentFrame == frames.size() - 1) && (!loop) && (!pingPong)) {
  	            stopped = true; 
  				break;
  			}
  			currentFrame = (currentFrame + direction) % frames.size();
  			
  			if (pingPong) {
  				if (currentFrame <= 0) {
  					currentFrame = 0;
  					direction = 1;   
  					if (!loop) {            
                          stopped = true;            
                          break;     
                      }       
  				}
  				else if (currentFrame >= frames.size()-1) {
  					currentFrame = frames.size()-1;
  					direction = -1;
  				}
  			}
  			int realDuration = (int) (((Frame) frames.get(currentFrame)).duration / speed);
  			nextChange = nextChange + realDuration;
  		}
  	}
docs: Check if we need to move to the next frame
  
  @param delta The amount of time thats passed since last update