新課上架囉!這次將帶給大家是 Android App 的動畫與 進階UI 實戰,這些都是對於APP開發者與優化者來說,不可或缺的職業技能哦!
View Animation 是Android最簡單使用的一種動畫呈現方式了,可以在各種View 上做透明度、大小、位置、旋轉的動畫。
透過xml定義動畫效果,xml置於res/anim目錄下
上一篇,我們用了xml的方式來實作動畫,這篇將 View animation 使用程式碼來實作動畫。
例如這個動畫,每次按Rotate就會順時針轉90度,就需要寫程式來控制。
RotateAnimation 旋轉動畫
val animation = RotateAnimation( fromDegree…
val animation = RotateAnimation( fromDegree
View animation很簡單很重要,所以這一篇會繼續把View animation 再深入一點:
到目前為止,我們已經知道了怎麼使用View animation。來個小小的動畫練習吧。
這是Facebook 的讚按鈕,我們就用到目前所學的來實作這個動畫
複習一下,View Animation 可以用來做旋轉、縮放、移動、透明度的動畫。我們先來分析一下這個動畫的組成,看起來只需要2張圖「還沒點讚」、「已點讚」。…
Property animation 更進階一些。
ObjectAnimator 一樣可以使用程式碼來實作動畫
例:Rotation
val anim = ObjectAnimator.ofFloat(textView, "rotation", 0.0f, 270.0f)anim.duration = 1000…
val anim = ObjectAnimator.ofFloat(textView, "rotation", 0.0f, 270.0f)anim.duration = 1000