void (long startMillis) { int numFrames = ourCycleTime / ourRepaintInterval; long timePassed = System.currentTimeMillis() - startMillis; setAnimationIndex((int) ((timePassed / ourRepaintInterval) % numFrames)); }