Search in sources :

Example 6 with CycleInterpolator

use of android.view.animation.CycleInterpolator in project FlycoDialog_Master by H07000223.

the class ShakeHorizontal method setAnimation.

@Override
public void setAnimation(View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -10, 10);
    animator.setInterpolator(new CycleInterpolator(5));
    animatorSet.playTogether(animator);
/**
		 * <pre>
		 *  另一种shake实现
		 * ObjectAnimator.ofFloat(view, "translationX", 0, 25, -25, 25, -25, 15, -15, 6, -6, 0);
		 * </pre>
		 */
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) CycleInterpolator(android.view.animation.CycleInterpolator)

Example 7 with CycleInterpolator

use of android.view.animation.CycleInterpolator in project SeaStar by 13120241790.

the class ClearWriteEditText method shakeAnimation.

/**
     * 晃动动画
     * @param counts 半秒钟晃动多少下
     * @return
     */
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 8 with CycleInterpolator

use of android.view.animation.CycleInterpolator in project smartmodule by carozhu.

the class ClearEditText method shakeAnimation.

/**
     * 晃动动画
     *
     * @param counts 1秒钟晃动多少下
     * @return
     */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) TranslateAnimation(android.view.animation.TranslateAnimation) CycleInterpolator(android.view.animation.CycleInterpolator)

Aggregations

CycleInterpolator (android.view.animation.CycleInterpolator)8 ObjectAnimator (android.animation.ObjectAnimator)3 Animation (android.view.animation.Animation)3 TranslateAnimation (android.view.animation.TranslateAnimation)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