這一篇,寫一下Interpolator的使用方法
Interpolator 定義了動畫的變化速率,在Animations框架當中定義了以下幾種Interpolator,在xml的set標籤中使用;
xml中實現:
android:interpolator="@android:anim/accelerate_interpolator"
Activity中實現:
AnimationSet aninationSet=new AnimationSet(true);
animationSet.setInterpolator(new AccelerateInterpolator());
1.AccelerateDecelerateInterpolator:在動畫開始和結束的時候速率改變比較慢,中間時候加速;
2.AccelerateInterpolator:在動畫開始時候速率改變比較慢,然後開始加速;
3.CycleInterpolator:動畫循環播放特定次數,速率改變沿着正弦曲線;
4.DecelerateInterpolator:在動畫開始的時候速率改變比較快,然後開始減速;
5.LinearInterpolator:動畫以均勻的速率改變;
在需要多個動畫疊加時:
在xml文件的set標籤中添加:
android:shareInterpolator=”true” //共享動畫效果