private int getCurrentIndex() {
    long current = System.currentTimeMillis();
    Frame frame = getFrames()[index];
    if (frame.getDelay() <= (current - time)) updateFrameAt(current);
    return index;
  }
private int getCurrentIndex()