android 動畫總結筆記 一

終于有時間可以詳細去了解一下 android動畫,先從android動畫基礎著手。在android 3.0之前android動畫api主要是android.view.Animation包下的內容,來先看看這個包里面主要的類![Animation成員](https://img-blog.csdn.net/20150709115201928 "Animation類圖")

<?xml version="1.0" encoding="utf-8"?>  
<set xmlns:android="http://schemas.android.com/apk/res/android"  
android:interpolator="@[package:]anim/interpolator_resource"  
android:shareInterpolator=["true" | "false"] >  
<alpha  
android:fromAlpha="float"  
android:toAlpha="float" />  
<scale  
android:fromXScale="float"  
android:toXScale="float"  
android:fromYScale="float"  
android:toYScale="float"  
android:pivotX="float"  
android:pivotY="float" />  
<translate  
android:fromXDelta="float"  
android:toXDelta="float"  
android:fromYDelta="float"  
android:toYDelta="float" />  
<rotate  
android:fromDegrees="float"  
android:toDegrees="float"  
android:pivotX="float"  
android:pivotY="float" />  
<set>  
...  
</set>  
</set>

布局文件必須有一個獨立的根元素,可以是,,,,(持有一組其它的動畫元素,可以是內嵌的set元素)中的一個
1****
android:interpolator動畫插補器,該值必須是了解一個指定插值器的引用(不是一個類名),在平臺中有缺省的插值器資源可以使用,或者自己創建插值器資源
android:shareInterpolator
Boolean 值,true:代表在所有的字元素中共享同一個插值器
Interpolator的具體使用方法
interpolator定義了動畫變化的速率,在Animations框架當中定義了一下幾種Interpolator
1、AccelerateDecelerateInterpolator:在動畫開始與結束的地方速率變化比較慢,在中間的時候速率快。
2、accelerateInterpolator:在動畫開始的地方速率變化比較慢,然后開始加速。
3、CycleInterpolator:動畫循環播放特定的次數,速率改變沿著正弦曲線
4、DecelerateInterpolator:在動畫開始的時候速率改變比較慢,然后開始減速
5、linearInterpolator:動畫以均勻的速率改變
自定義插值器
如果你對系統提供的插值器不滿意,我們可以創建一個插值器資源修改插值器的屬性,比如修改Aniticipateinterpolator的加速速率,調整CycleInterpolator的循環次數等,為了完成這種序曲,我們需要創建xml資源文件,然后再動畫元素中引用即可。幾種常用的插值器可調整的屬性

android:factor 浮點值,加速速率,默認為1
android:tension 浮點值,起始點后退的張力、拉力數,默認為2
android:tension 同上 android:extraTension 浮點值,拉力的倍數,默認1.5(2 *1.5)

android:cycles int,循環的個數,默認為1
android:factor 浮點值,減速的速率,默認為1

浮點值,超出終點后的張力、拉力,默認為2

<?xml version="1.0" encoding="utf-8"?>  
<overshootInterpolator xmlns:android="http://schemas.android.com/apk/res/android"  
android:tension="7.0"/>  
This animation XML will apply the interpolator:  
<scale xmlns:android="http://schemas.android.com/apk/res/android"  
android:interpolator="@anim/my_overshoot_interpolator"  
android:fromXScale="1.0"  
android:toXScale="3.0"  
android:fromYScale="1.0"  
android:toYScale="3.0"  
android:pivotX="50%"  
android:pivotY="50%"  
android:duration="700" />

如果簡單的修改插值器的屬性還不能夠滿足我們的需求,那么就自己來通過實現Interplator接口來定義自己的插值器,上面所有的Interpolator都實現了Interpolator接口,這個接口定義了一個方法:float getInterpolation(float intput);
此方法由系統調用,input代表動畫的時間,在0和1之間,也就是開始和結束。

Frame動畫

<?xml version="1.0" encoding="utf-8"?>  
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"  
android:oneshot=["true" | "false"] >  
<item  
android:drawable="@[package:]drawable/drawable_resource_name"  
android:duration="integer" />  
</animation-list>

必須作為跟元素,包含一個或者多個根元素
屬性:android:oneshot: true: 只執行一次動畫, false: 循環執行
一幀獨立動畫,必須是的子元素
屬性:drawable資源圖片
android:duration integer類型,該幀的時長,單位為毫秒

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/389195.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/389195.shtml
英文地址,請注明出處:http://en.pswp.cn/news/389195.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

《Linux內核原理與分析》第六周作業

課本&#xff1a;第五章 系統調用的三層機制&#xff08;下&#xff09; 中斷向量0x80和system_call中斷服務程序入口的關系 0x80對應著system_call中斷服務程序入口&#xff0c;在start_kernel函數中調用了trap_init函數&#xff0c;trap_init函數中調用了set_system_trap_gat…

使用C#調用外部Ping命令獲取網絡連接情況

使用C#調用外部Ping命令獲取網絡連接情況 以前在玩Windows 98的時候&#xff0c;幾臺電腦連起來&#xff0c;需要測試網絡連接是否正常&#xff0c;經常用的一個命令就是Ping.exe。感覺相當實用。 現在 .net為我們提供了強大的功能來調用外部工具&#xff0c;并通過重定向輸…

Codeforces Round 493

心情不好&#xff0c;被遣散回學校 &#xff0c;心態不好 &#xff0c;為什么會累&#xff0c;一直微笑就好了 #include<bits/stdc.h> using namespace std; int main() {freopen("in","r",stdin);\freopen("out","w",stdout);i…

android動畫筆記二

從android3.0&#xff0c;系統提供了一個新的動畫&#xff0d;property animation, 為什么系統會提供這樣一個全新的動畫包呢&#xff0c;先來看看之前的補間動畫都有什么缺陷吧1、傳統的補間動畫都是固定的編碼&#xff0c;功能是固定的&#xff0c;擴展難度大。比如傳統動畫只…

回歸分析檢驗_回歸分析

回歸分析檢驗Regression analysis is a reliable method in statistics to determine whether a certain variable is influenced by certain other(s). The great thing about regression is also that there could be multiple variables influencing the variable of intere…

是什么樣的騷操作讓應用上線節省90%的時間

優秀的程序員 總會想著 如何把花30分鐘才能解決的問題 在5分鐘內就解決完 例如在應用上線這件事上 通常的做法是 構建項目在本地用maven打包 每次需要clean一次&#xff0c;再build一次 部署包在本地ide、git/svn、maven/gradie 及代碼倉庫、鏡像倉庫和云平臺間 來回切換 上傳部…

QQ API

QQ API設計說明書目錄一、引言 31.1 編寫目的 31.2 更新時間 3二、總體設計 3三、注冊的系統消息 33.1 WM_QQAPI_REGISTER 33.2 WM_QQAPI_REGISTER_RESP 43.3 WM_QQAPI_AVAILABLE 4四、從設備到QQ的自定義事件 54.1 EVENT_QQAPI_SET_AUDIODEVICE …

Ubuntu 18.04 下如何配置mysql 及 配置遠程連接

首先是大家都知道的老三套&#xff0c;啥也不說上來就放三個大招&#xff1a; sudo apt-get install mysql-serversudo apt isntall mysql-clientsudo apt install libmysqlclient-dev 這三步下來mysql就裝好了&#xff0c;然后我們偷偷檢查一下 sudo netstat -tap | grep mysq…

數據科學與大數據技術的案例_主數據科學案例研究,招聘經理的觀點

數據科學與大數據技術的案例I’ve been in that situation where I got a bunch of data science case studies from different companies and I had to figure out what the problem was, what to do to solve it and what to focus on. Conversely, I’ve also designed case…

導致View樹遍歷的時機

遍歷View樹意味著整個View需要重新對其包含的子視圖分配大小并重繪&#xff0c;導致重新遍歷的原因主要有三個 1.視圖本身內部狀況變化引起重繪。 2.第二個是View樹內部添加或者刪除了View。 3.View本身的大小及可見性發生變化。 能引起View樹重新遍歷的操作&#xff0c;總…

什么是Hyperledger?Linux如何圍繞英特爾的區塊鏈項目構建開放平臺?

訪問區塊鏈會議并關注區塊鏈新聞時&#xff0c;不可避免地&#xff0c;您會遇到Linux基金會的Hyperledger。理解像比特幣、以太坊這樣的加密貨幣還算相對容易的&#xff0c;Hyperledger卻不然。但如果你多研究研究&#xff0c;你會發現一些令人興奮的非貨幣、工業區塊鏈的應用項…

隊列的鏈式存儲結構及其實現_了解隊列數據結構及其實現

隊列的鏈式存儲結構及其實現A queue is a collection of items whereby its operations work in a FIFO — First In First Out manner. The two primary operations associated with them are enqueue and dequeue.隊列是項目的集合&#xff0c;由此其操作以FIFO(先進先出)的方…

安裝

、添加一個新項目->選擇類庫模板->命名為DBCustomAction 2、單擊項目右鍵->添加新項->選擇安裝程序類(命名為DBCustomAction.cs) 3、在 服務器資源管理器中添加->連接到 數據庫->指定用戶密碼(選擇允許保存密碼)-> 數據庫選擇master 4、切換到DBCustomAct…

cad2016珊瑚_預測有馬的硬珊瑚覆蓋率

cad2016珊瑚What’s the future of the world’s coral reefs?世界珊瑚礁的未來是什么&#xff1f; In February of 2020, scientists at University of Hawaii Manoa released a study addressing this very question. The models they developed forecasted a 70–90% worl…

EChart中使用地圖方式總結(轉載)

EChart中使用地圖方式總結 2018年02月06日 22:18:57 來源&#xff1a;https://blog.csdn.net/shaxiaozilove/article/details/79274772最近在仿照EChart公交線路方向示例&#xff0c;開發表示排水網和污水網流向地圖&#xff0c;同時地圖上需要疊加排放口、污染源、污水處理廠等…

android mvp模式

越來越多人討論mvp模式&#xff0c;mvp在android應用開發中獲得更多的重視&#xff0c;這里說一下對MVP的簡單了解。 什么是 MVP? MVP模式使邏輯從視圖層分開&#xff0c;目的是我們在屏幕上怎么表現&#xff0c;和界面如何工作的所有事情就完全分開了。 View顯示數據&…

Node.js REPL(交互式解釋器)

2019獨角獸企業重金招聘Python工程師標準>>> Node.js REPL(交互式解釋器) Node.js REPL(Read Eval Print Loop:交互式解釋器) 表示一個電腦的環境&#xff0c;類似 Window 系統的終端或 Unix/Linux shell&#xff0c;我們可以在終端中輸入命令&#xff0c;并接收系統…

中國移動短信網關CMPP3.0 C#源代碼:使用示例

中國移動短信網關CMPP3.0 C#源代碼&#xff1a;使用示例 中國移動短信網關CMPP3.0 C#源代碼使用&#xff0c;在上一篇文章中我介紹過cmpp3.0,這段時間因為也做關于移動短信網關的開發&#xff0c;在這里給大家一個演示如何使用cmpp3.0開發移動短信網關。Using Tiray.SMS... Ti…

用python進行營銷分析_用python進行covid 19分析

用python進行營銷分析Python is a highly powerful general purpose programming language which can be easily learned and provides data scientists a wide variety of tools and packages. Amid this pandemic period, I decided to do an analysis on this novel coronav…

名稱

命名規則&#xff1a;Go中函數、變量、常量、類型、語句標簽和包的名稱都遵循一個規則&#xff0c;開頭是一個字母或下劃線&#xff0c;后面跟任意字符、數字和下劃線&#xff0c;并區分大小寫。例如&#xff1a;heapSort和HeapSort是不同名稱。關鍵字&#xff1a;Go有25個關鍵…