透明
//在2s内,将imageView的透明度从1变成0然后再变成1。 ObjectAnimator animator = ObjectAnimator.ofFloat(mImg, "alpha", 1f, 0f,1f); animator.setDuration(2000);//时间1s animator.start();
旋转
//在2s内,顺时针旋转360度,然后再逆时针旋转360度。 ObjectAnimator animator2 = ObjectAnimator.ofFloat(mImg, "rotation", 0f, 360f, 0f); animator2.setDuration(2000); animator2.start();
移动
//在2s内,沿x轴左移300个像素,然后再右移300个像素 ObjectAnimator animator3 = ObjectAnimator.ofFloat(mImg, "translationX", 0f, -300f, 0f); animator3.setDuration(2000); animator3.start();
缩放
//在2s内,沿x轴放大成原来的两倍,然后缩小回原样。 ObjectAnimator animator4 = ObjectAnimator.ofFloat(mImg, "scaleX", 1f, 2f, 1f); animator4.setDuration(2000); animator4.start();