Search in sources :

Example 26 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project JamsMusicPlayer by psaravan.

the class BrowserSubGridActivity method slideAwayHeader.

/**
     *
     */
/**
     * Slides away the header layout.
     */
private void slideAwayHeader() {
    TranslateAnimation slideDown = new TranslateAnimation(mHeaderLayout, 400, new AccelerateInterpolator(2.0f), View.INVISIBLE, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -2.0f);
    slideDown.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
            mHeaderLayout.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mHeaderLayout.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    slideDown.animate();
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) TranslateAnimation(com.jams.music.player.Animations.TranslateAnimation) Animation(android.view.animation.Animation) TranslateAnimation(com.jams.music.player.Animations.TranslateAnimation)

Example 27 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project JamsMusicPlayer by psaravan.

the class QueueDrawerFragment method animatePauseToPlay.

/**
     * Animates the pause button to a play button.
     */
private void animatePauseToPlay() {
    //Check to make sure the current icon is the pause icon.
    if (mPlayPauseButton.getId() != R.drawable.pause_light)
        return;
    //Scale out the pause button.
    final ScaleAnimation scaleOut = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, mPlayPauseButton.getWidth() / 2, mPlayPauseButton.getHeight() / 2);
    scaleOut.setDuration(150);
    scaleOut.setInterpolator(new AccelerateInterpolator());
    //Scale in the play button.
    final ScaleAnimation scaleIn = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, mPlayPauseButton.getWidth() / 2, mPlayPauseButton.getHeight() / 2);
    scaleIn.setDuration(150);
    scaleIn.setInterpolator(new DecelerateInterpolator());
    scaleOut.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mPlayPauseButton.setImageResource(R.drawable.play_light);
            mPlayPauseButton.setPadding(0, 0, -5, 0);
            mPlayPauseButton.startAnimation(scaleIn);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    scaleIn.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mPlayPauseButton.setScaleX(1.0f);
            mPlayPauseButton.setScaleY(1.0f);
            mPlayPauseButton.setId(R.drawable.play_light);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    mPlayPauseButton.startAnimation(scaleOut);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 28 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project JamsMusicPlayer by psaravan.

the class QueueDrawerFragment method animatePlayToPause.

/**
     * Animates the play button to a pause button.
     */
private void animatePlayToPause() {
    //Check to make sure the current icon is the play icon.
    if (mPlayPauseButton.getId() != R.drawable.play_light)
        return;
    //Fade out the play button.
    final ScaleAnimation scaleOut = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, mPlayPauseButton.getWidth() / 2, mPlayPauseButton.getHeight() / 2);
    scaleOut.setDuration(150);
    scaleOut.setInterpolator(new AccelerateInterpolator());
    //Scale in the pause button.
    final ScaleAnimation scaleIn = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, mPlayPauseButton.getWidth() / 2, mPlayPauseButton.getHeight() / 2);
    scaleIn.setDuration(150);
    scaleIn.setInterpolator(new DecelerateInterpolator());
    scaleOut.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mPlayPauseButton.setImageResource(R.drawable.pause_light);
            mPlayPauseButton.setPadding(0, 0, 0, 0);
            mPlayPauseButton.startAnimation(scaleIn);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    scaleIn.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mPlayPauseButton.setScaleX(1.0f);
            mPlayPauseButton.setScaleY(1.0f);
            mPlayPauseButton.setId(R.drawable.pause_light);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    mPlayPauseButton.startAnimation(scaleOut);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 29 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project FlyRefresh by race604.

the class MainActivity method bounceAnimateView.

private void bounceAnimateView(View view) {
    if (view == null) {
        return;
    }
    Animator swing = ObjectAnimator.ofFloat(view, "rotationX", 0, 30, -20, 0);
    swing.setDuration(400);
    swing.setInterpolator(new AccelerateInterpolator());
    swing.start();
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator)

Example 30 with AccelerateInterpolator

use of android.view.animation.AccelerateInterpolator in project SmoothProgressBar by castorflex.

the class MakeCustomActivity method setInterpolator.

private void setInterpolator(int position) {
    switch(position) {
        case 1:
            mCurrentInterpolator = new LinearInterpolator();
            mSeekBarFactor.setEnabled(false);
            break;
        case 2:
            mCurrentInterpolator = new AccelerateDecelerateInterpolator();
            mSeekBarFactor.setEnabled(false);
            break;
        case 3:
            mCurrentInterpolator = new DecelerateInterpolator(mFactor);
            mSeekBarFactor.setEnabled(true);
            break;
        case 4:
            mCurrentInterpolator = new FastOutSlowInInterpolator();
            mSeekBarFactor.setEnabled(true);
            break;
        case 0:
        default:
            mCurrentInterpolator = new AccelerateInterpolator(mFactor);
            mSeekBarFactor.setEnabled(true);
            break;
    }
    mProgressBar.setSmoothProgressDrawableInterpolator(mCurrentInterpolator);
    mProgressBar.setSmoothProgressDrawableColors(getResources().getIntArray(R.array.gplus_colors));
    updateValues();
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator)

Aggregations

AccelerateInterpolator (android.view.animation.AccelerateInterpolator)186 Animator (android.animation.Animator)62 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)54 View (android.view.View)52 ObjectAnimator (android.animation.ObjectAnimator)41 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)40 ImageView (android.widget.ImageView)26 AnimatorSet (android.animation.AnimatorSet)24 TextView (android.widget.TextView)23 Animation (android.view.animation.Animation)21 ValueAnimator (android.animation.ValueAnimator)17 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)14 LinearInterpolator (android.view.animation.LinearInterpolator)14 TranslateAnimation (android.view.animation.TranslateAnimation)14 OvershootInterpolator (android.view.animation.OvershootInterpolator)13 Point (android.graphics.Point)12 Paint (android.graphics.Paint)10 Interpolator (android.view.animation.Interpolator)9 AlphaAnimation (android.view.animation.AlphaAnimation)8 AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)8