Java Code Examples for android.view.animation.AccelerateInterpolator#getInterpolation()

The following examples show how to use android.view.animation.AccelerateInterpolator#getInterpolation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnimatorBarRms.java    From DroidSpeech with Apache License 2.0 5 votes vote down vote up
private void animateUp(long delta)
{
    boolean finished = false;
    int minHeight = (int) (fromHeightPart * bar.getMaxHeight());
    int toHeight = (int) (bar.getMaxHeight() * toHeightPart);

    float timePart = (float) delta / BAR_ANIMATION_UP_DURATION;

    AccelerateInterpolator interpolator = new AccelerateInterpolator();
    int height = minHeight + (int) (interpolator.getInterpolation(timePart) * (toHeight - minHeight));

    if (height < bar.getHeight()) {
        return;
    }

    if (height >= toHeight) {
        height = toHeight;
        finished = true;
    }

    bar.setHeight(height);
    bar.update();

    if (finished) {
        isUpAnimation = false;
        startTimestamp = System.currentTimeMillis();
    }
}
 
Example 2
Source File: BarRmsAnimator.java    From android-speech with Apache License 2.0 5 votes vote down vote up
private void animateUp(long delta) {
    boolean finished = false;
    int minHeight = (int) (fromHeightPart * bar.getMaxHeight());
    int toHeight = (int) (bar.getMaxHeight() * toHeightPart);

    float timePart = (float) delta / BAR_ANIMATION_UP_DURATION;

    AccelerateInterpolator interpolator = new AccelerateInterpolator();
    int height = minHeight + (int) (interpolator.getInterpolation(timePart) * (toHeight - minHeight));

    if (height < bar.getHeight()) {
        return;
    }

    if (height >= toHeight) {
        height = toHeight;
        finished = true;
    }

    bar.setHeight(height);
    bar.update();

    if (finished) {
        isUpAnimation = false;
        startTimestamp = System.currentTimeMillis();
    }
}
 
Example 3
Source File: BarRmsAnimator.java    From SpeechRecognitionView with Apache License 2.0 5 votes vote down vote up
private void animateUp(long delta) {
    boolean finished = false;
    int minHeight = (int) (fromHeightPart * bar.getMaxHeight());
    int toHeight = (int) (bar.getMaxHeight() * toHeightPart);

    float timePart = (float) delta / BAR_ANIMATION_UP_DURATION;

    AccelerateInterpolator interpolator = new AccelerateInterpolator();
    int height = minHeight + (int) (interpolator.getInterpolation(timePart) * (toHeight - minHeight));

    if (height < bar.getHeight()) {
        return;
    }

    if (height >= toHeight) {
        height = toHeight;
        finished = true;
    }

    bar.setHeight(height);
    bar.update();

    if (finished) {
        isUpAnimation = false;
        startTimestamp = System.currentTimeMillis();
    }
}