之曲線動畫(Curved motion(曲線運動))

Material design中的動畫依靠曲線,這個曲線適用於時間插值器和控件運動模式。
PathInterpolator類是一個基於貝塞爾曲線(Bézier curve)或路徑(Path)對象上的新的插值器。
在materialdesign規範中,系統提供了三個基本的曲線:
@interpolator/fast_out_linear_in.xml
@interpolator/fast_out_slow_in.xml
@interpolator/linear_out_slow_in.xml
你可以傳遞一個PathInterpolator對象給Animator.setInterpolator()方法。
ObjectAnimator類有了新的構造方法,使你能夠一次能同時使用兩個或多個屬性去繪製動畫的路徑。例如,下面的動畫使用一個Path對象進行視圖X和Y屬性的動畫繪製:

ObjectAnimator mAnimator;  
mAnimator = ObjectAnimator.ofFloat(view, View.X, View.Y, path);  
...  
mAnimator.start(); 

在Android 5.0 提供的API Demos -》Animation/Path Animations 就有一個例子使用了曲線動畫:
這裏寫圖片描述
參考資料: http://blog.csdn.net/ljx19900116/article/details/41806917

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