void (double value) { if (value == 1.0) { // should happen only if animator doesn't play animations myConsumer.accept((int) round(myTargetValue)); stop(); return; } if (myShouldStop.test((int)round(myCurrentValue))) { stop(); return; } myLastEventTime = System.currentTimeMillis(); long currentEventTime = min(myLastEventTime, myStartEventTime + myDuration); myCurrentValue = mySettings.getEasing().calc(currentEventTime - myStartEventTime, myInitValue, myTargetValue - myInitValue, myDuration); myConsumer.accept((int) round(myCurrentValue)); if (myLastEventTime >= myStartEventTime + myDuration) { stop(); } }