Search in sources :

Example 81 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project JustAndroid by chinaltz.

the class AbAnimationUtil method playJumpAnimation.

/**
	 * 跳动-跳起动画.
	 *
	 * @param view the view
	 * @param offsetY the offset y
	 */
private void playJumpAnimation(final View view, final float offsetY) {
    float originalY = 0;
    float finalY = -offsetY;
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(new TranslateAnimation(0, 0, originalY, finalY));
    animationSet.setDuration(300);
    animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animationSet.setFillAfter(true);
    animationSet.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            playLandAnimation(view, offsetY);
        }
    });
    view.startAnimation(animationSet);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) AnimationListener(android.view.animation.Animation.AnimationListener) AnimationSet(android.view.animation.AnimationSet)

Example 82 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project JustAndroid by chinaltz.

the class AbAnimationUtil method scaleView.

/**
	 * 缩放View的显示.
	 *
	 * @param view 需要改变的View
	 * @param toSize 缩放的大小,其中正值代表放大,负值代表缩小,数值代表缩放的倍数
	 */
private static void scaleView(final View view, float toSize) {
    ScaleAnimation scale = null;
    if (toSize == 0) {
        return;
    } else if (toSize > 0) {
        scale = new ScaleAnimation(1.0f, toSize, 1.0f, toSize, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    } else {
        scale = new ScaleAnimation(toSize * (-1), 1.0f, toSize * (-1), 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    }
    scale.setDuration(aniDurationMillis);
    scale.setInterpolator(new AccelerateDecelerateInterpolator());
    scale.setFillAfter(true);
    view.startAnimation(scale);
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 83 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project KJFrameForAndroid by kymjs.

the class KJDragGridView method animateReorder.

/**
     * item的交换动画效果
     * 
     * @param oldPosition
     * @param newPosition
     */
private void animateReorder(final int oldPosition, final int newPosition) {
    boolean isForward = newPosition > oldPosition;
    List<Animator> resultList = new LinkedList<Animator>();
    if (isForward) {
        for (int pos = oldPosition; pos < newPosition; pos++) {
            View view = getChildAt(pos - getFirstVisiblePosition());
            if (view == null) {
                continue;
            }
            if ((pos + 1) % mNumColumns == 0) {
                resultList.add(createTranslationAnimations(view, -view.getWidth() * (mNumColumns - 1), 0, view.getHeight(), 0));
            } else {
                resultList.add(createTranslationAnimations(view, view.getWidth(), 0, 0, 0));
            }
        }
    } else {
        for (int pos = oldPosition; pos > newPosition; pos--) {
            View view = getChildAt(pos - getFirstVisiblePosition());
            if ((pos + mNumColumns) % mNumColumns == 0) {
                resultList.add(createTranslationAnimations(view, view.getWidth() * (mNumColumns - 1), 0, -view.getHeight(), 0));
            } else {
                resultList.add(createTranslationAnimations(view, -view.getWidth(), 0, 0, 0));
            }
        }
    }
    AnimatorSet resultSet = new AnimatorSet();
    resultSet.playTogether(resultList);
    resultSet.setDuration(300);
    resultSet.setInterpolator(new AccelerateDecelerateInterpolator());
    resultSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            mAnimationEnd = false;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mAnimationEnd = true;
        }
    });
    resultSet.start();
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) GridView(android.widget.GridView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) LinkedList(java.util.LinkedList)

Example 84 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project ImagePicker by jeasonlzy.

the class FolderPopUpWindow method exitAnimator.

private void exitAnimator() {
    ObjectAnimator alpha = ObjectAnimator.ofFloat(masker, "alpha", 1, 0);
    ObjectAnimator translationY = ObjectAnimator.ofFloat(listView, "translationY", 0, listView.getHeight());
    AnimatorSet set = new AnimatorSet();
    set.setDuration(300);
    set.playTogether(alpha, translationY);
    set.setInterpolator(new AccelerateDecelerateInterpolator());
    set.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
            listView.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            FolderPopUpWindow.super.dismiss();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    set.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet)

Example 85 with AccelerateDecelerateInterpolator

use of android.view.animation.AccelerateDecelerateInterpolator in project ImagePicker by jeasonlzy.

the class FolderPopUpWindow method enterAnimator.

private void enterAnimator() {
    ObjectAnimator alpha = ObjectAnimator.ofFloat(masker, "alpha", 0, 1);
    ObjectAnimator translationY = ObjectAnimator.ofFloat(listView, "translationY", listView.getHeight(), 0);
    AnimatorSet set = new AnimatorSet();
    set.setDuration(400);
    set.playTogether(alpha, translationY);
    set.setInterpolator(new AccelerateDecelerateInterpolator());
    set.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet)

Aggregations

AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)165 ValueAnimator (android.animation.ValueAnimator)38 ObjectAnimator (android.animation.ObjectAnimator)31 Animator (android.animation.Animator)30 View (android.view.View)30 AnimatorSet (android.animation.AnimatorSet)22 Animation (android.view.animation.Animation)19 Handler (android.os.Handler)15 NonNull (android.support.annotation.NonNull)12 TranslateAnimation (android.view.animation.TranslateAnimation)12 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)11 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)10 AlphaAnimation (android.view.animation.AlphaAnimation)10 ImageView (android.widget.ImageView)10 TextView (android.widget.TextView)10 Paint (android.graphics.Paint)9 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)9 LinearInterpolator (android.view.animation.LinearInterpolator)9 ScaleAnimation (android.view.animation.ScaleAnimation)9 PropertyValuesHolder (android.animation.PropertyValuesHolder)8