屬性動畫最全講解

屬性動畫最明白的講解

 最簡單的例子:

//最簡單的漸入漸出效果,
// “ofFloat”標識後面的數值變化量是【Float】類型
//第一個參數隨便填寫,不一定非要侷限在view範圍內
//第二個參數也是隨便寫,但是要保證這個參數代表的含義是第一個參數具有的,【例如:如果是view的話,
// 所傳的參數可以是在layout佈局內,這個view所代表的所有標識(“background”“translationX”“scaleX”等等)】
//從第三個參數開始,參數數量也是沒有限制的,可以是兩個或者是三個,或者是十萬個都可以!代表的含義就是漸變的過程
 ObjectAnimator animator = ObjectAnimator.ofFloat(shop_buyer_parent, "alpha", 0.0f, 1.0f, 0.0f);
 animator.setDuration(3000);
 animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
       @Override
       public void onAnimationUpdate(ValueAnimator animation) {
           float currentValue = (float) animation.getAnimatedValue();
           Log_Ma.d("TAG", "cuurent value is " + currentValue);
           }
       });
 animator.start();

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章