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;
}
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);
}
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;
}
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;
}
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();
}
Aggregations