/**
* 晃动动画
* @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;
}
java类android.view.animation.CycleInterpolator的实例源码
ClearEditText.java 文件源码
项目:smile-mvp
阅读 30
收藏 0
点赞 0
评论 0
MainActivity.java 文件源码
项目:drawLayout
阅读 33
收藏 0
点赞 0
评论 0
private void initListener() {
mDragLayout.setDragStatusListener(new OnDragStatusChangeListener() {
@Override
public void onOpen() {
Utils.showToast(MainActivity.this, "onOpen");
// 左面板ListView随机设置一个条目
Random random = new Random();
Log.i(TAG, "onOpen:=" +mDragLayout.getRange());
int nextInt = random.nextInt(50);
mLeftList.smoothScrollToPosition(nextInt);
}
@Override
public void onDraging(float percent) {
Log.d(TAG, "onDraging: " + percent);// 0 -> 1
// 更新图标的透明度
// 1.0 -> 0.0
ViewHelper.setAlpha(mHeaderImage, 1 - percent);
}
@Override
public void onClose() {
Utils.showToast(MainActivity.this, "onClose");
// 让图标晃动
// mHeaderImage.setTranslationX(translationX)
ObjectAnimator mAnim = ObjectAnimator.ofFloat(mHeaderImage, "translationX", 15.0f);
mAnim.setInterpolator(new CycleInterpolator(4));
mAnim.setDuration(500);
mAnim.start();
}
});
}
ShakeHorizontal.java 文件源码
项目:SprintNBA
阅读 27
收藏 0
点赞 0
评论 0
@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>
*/
}
ClearCityEditText.java 文件源码
项目:MyHearts
阅读 25
收藏 0
点赞 0
评论 0
/**
* 抖动动动画
* counts 1秒钟晃动多少下
*/
public static Animation shakeAnimation(int counts){
Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
translateAnimation.setInterpolator(new CycleInterpolator(counts));
translateAnimation.setDuration(1000);
return translateAnimation;
}
KeyRect.java 文件源码
项目:android-passcodeview
阅读 23
收藏 0
点赞 0
评论 0
/**
* Show animation indicated invalid pincode
*/
public void setError() {
ValueAnimator goLeftAnimator = ValueAnimator.ofInt(0, 5);
goLeftAnimator.setInterpolator(new CycleInterpolator(2));
goLeftAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override public void onAnimationUpdate(ValueAnimator animation) {
rect.left += (int) animation.getAnimatedValue();
rect.right += (int) animation.getAnimatedValue();
view.invalidate();
}
});
goLeftAnimator.start();
}
AnimationUtils.java 文件源码
项目:BaseLibrary
阅读 28
收藏 0
点赞 0
评论 0
/**
* 左右摇晃
*
* @param counts 晃动次数
* @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;
}
ClearCityEditText.java 文件源码
项目:TravelAround
阅读 24
收藏 0
点赞 0
评论 0
/**
* 抖动动动画
* counts 1秒钟晃动多少下
*/
public static Animation shakeAnimation(int counts){
Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
translateAnimation.setInterpolator(new CycleInterpolator(counts));
translateAnimation.setDuration(1000);
return translateAnimation;
}
ClearWriteEditText.java 文件源码
项目:sealtalk-android
阅读 29
收藏 0
点赞 0
评论 0
/**
* 晃动动画
* @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;
}
PathFragment.java 文件源码
项目:AndroidAnimationDemo
阅读 22
收藏 0
点赞 0
评论 0
@OnClick(R.id.btn_start)
public void onAction() {
float start = mView.getY();
if (start > 680f) {
start = 0f;
mView.setY(0f);
}
ObjectAnimator anim = ObjectAnimator.ofFloat(mView, "Y", start, mView.getY() + 180f);
anim.setDuration(800);
anim.setInterpolator(new CycleInterpolator(0.5f));
anim.start();
}
AnimationUtils.java 文件源码
项目:MaterialHome
阅读 24
收藏 0
点赞 0
评论 0
/**
* 晃动动画
*
* @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;
}