屬性動畫解析
主要就是用ObjectAnimator,
方法很簡單,給一個View,然後給字元串參數,然後給值,給多少都行,非常友善
ObjectAnimator animator = ObjectAnimator.ofFloat(textview, "alpha", 1f, 0f, 1f).setDuration(3000).start();
ObjectAnimator animator = ObjectAnimator.ofFloat(textview, "rotation", 0f, 360f).setDuration(3000).start();
float curTranslationX = textview.getTranslationX();
ObjectAnimator animator = ObjectAnimator.ofFloat(textview, "translationX", curTranslationX, -500f, curTranslationX).setDuration(3000).start();
ObjectAnimator animator = ObjectAnimator.ofFloat(textview, "scaleY", 1f, 3f, 1f).setDuration(3000).start();
給的參數其實就是根據View的方法來的
setRotation()、getRotation()、setTranslationX()、getTranslationX()、setScaleY()、getScaleY()
給的就是rotation,translationX,scaleY
當然還有rotationX,rotaionY,translationY,scaleX等等