Search in sources :

Example 1 with CycleInterpolator

use of android.view.animation.CycleInterpolator in project ViewAnimator by florent37.

the class AnimationBuilder method shake.

public AnimationBuilder shake() {
    translationX(0, 25, -25, 25, -25, 15, -15, 6, -6, 0);
    interpolator(new CycleInterpolator(5));
    return this;
}
Also used : CycleInterpolator(android.view.animation.CycleInterpolator)

Example 2 with CycleInterpolator

use of android.view.animation.CycleInterpolator in project Lazy by l123456789jy.

the class ViewAnimationUtils method translate.

/*
	 *  ************************************************************* 视图移动动画
	 * ********************************************************************
	 */
/**
     * 视图移动
     *
     * @param view           要移动的视图
     * @param fromXDelta     X轴开始坐标
     * @param toXDelta       X轴结束坐标
     * @param fromYDelta     Y轴开始坐标
     * @param toYDelta       Y轴结束坐标
     * @param cycles         重复
     * @param durationMillis 持续时间
     * @param isBanClick     在执行动画的过程中是否禁止点击
     */
public static void translate(final View view, float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, float cycles, long durationMillis, final boolean isBanClick) {
    TranslateAnimation translateAnimation = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta);
    translateAnimation.setDuration(durationMillis);
    if (cycles > 0.0) {
        translateAnimation.setInterpolator(new CycleInterpolator(cycles));
    }
    translateAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
            if (isBanClick) {
                view.setClickable(false);
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            if (isBanClick) {
                view.setClickable(true);
            }
        }
    });
    view.startAnimation(translateAnimation);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) CycleInterpolator(android.view.animation.CycleInterpolator) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 3 with CycleInterpolator

use of android.view.animation.CycleInterpolator in project SmartCampus by Vegen.

the class CleanEditText method shakeAnimation.

public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) TranslateAnimation(android.view.animation.TranslateAnimation) CycleInterpolator(android.view.animation.CycleInterpolator)

Example 4 with CycleInterpolator

use of android.view.animation.CycleInterpolator in project PaymentKit-Droid by brendanw.

the class AnimUtils method getShakeAnimation.

/**
     * @param shouldResetTextColor if true make sure you end the previous animation before starting this one.
     */
public static ObjectAnimator getShakeAnimation(final TextView textView, final boolean shouldResetTextColor) {
    final int textColor = textView.getCurrentTextColor();
    textView.setTextColor(Color.RED);
    ObjectAnimator shakeAnim = ObjectAnimator.ofFloat(textView, "translationX", -16);
    shakeAnim.setDuration(SHAKE_DURATION);
    shakeAnim.setInterpolator(new CycleInterpolator(2.0f));
    shakeAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator anim) {
            if (shouldResetTextColor) {
                textView.setTextColor(textColor);
            }
        }
    });
    return shakeAnim;
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) CycleInterpolator(android.view.animation.CycleInterpolator)

Example 5 with CycleInterpolator

use of android.view.animation.CycleInterpolator in project PaymentKit-Droid by brendanw.

the class CardNumHolder method indicateInvalidCardNum.

public void indicateInvalidCardNum() {
    getCardField().setTextColor(Color.RED);
    mTopItem = mCardNumberEditText;
    ObjectAnimator shakeAnim = ObjectAnimator.ofFloat(getCardField(), "translationX", -16);
    shakeAnim.setDuration(SHAKE_DURATION);
    shakeAnim.setInterpolator(new CycleInterpolator(2.0f));
    shakeAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator anim) {
            mTopItem = null;
        }
    });
    shakeAnim.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) CycleInterpolator(android.view.animation.CycleInterpolator)

Aggregations

CycleInterpolator (android.view.animation.CycleInterpolator)9 Animation (android.view.animation.Animation)4 TranslateAnimation (android.view.animation.TranslateAnimation)4 ObjectAnimator (android.animation.ObjectAnimator)3 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 AlphaAnimation (android.view.animation.AlphaAnimation)1 AnimationListener (android.view.animation.Animation.AnimationListener)1 Animator (com.nineoldandroids.animation.Animator)1 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)1 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)1