2023學(xué)年完整公開課版補(bǔ)間動(dòng)畫Alpha_第1頁(yè)
2023學(xué)年完整公開課版補(bǔ)間動(dòng)畫Alpha_第2頁(yè)
2023學(xué)年完整公開課版補(bǔ)間動(dòng)畫Alpha_第3頁(yè)
2023學(xué)年完整公開課版補(bǔ)間動(dòng)畫Alpha_第4頁(yè)
2023學(xué)年完整公開課版補(bǔ)間動(dòng)畫Alpha_第5頁(yè)
已閱讀5頁(yè),還剩8頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

《通信業(yè)務(wù)開發(fā)》課程補(bǔ)間動(dòng)畫-Alpha補(bǔ)間動(dòng)畫-AlphaPART22-5動(dòng)畫原理相關(guān)類XML配置屬性實(shí)例演示動(dòng)畫原理示例漸變動(dòng)畫:根據(jù)起始/終止透明度,計(jì)算并漸變編碼實(shí)現(xiàn)AlphaAnimation<AnimationSet>AccelerateInterpolatorXML配置/res/anim<alpha><set

startOffset>

動(dòng)畫集時(shí)間偏移<interpolator>加速器AnimationUtils.loadAnimationstartAnimation實(shí)現(xiàn)No.屬性描述1android:fromAlpha

動(dòng)畫開始的透明度從0.0--1.00.0完全透明1.0完全不透明2android:toAlpha

動(dòng)畫結(jié)束時(shí)的透明度從0.0--1.00.0完全透明1.0完全不透明相關(guān)類與屬性AlphaAnimation1No.方法名稱類型描述1publicAnimationSet(booleanshareInterpolator)構(gòu)造true,使用Set的Interpolatorfalse,使用動(dòng)畫的Interpolator2publicvoidaddAnimation(Animationa)普通增加一個(gè)Animation組件3publicList<Animation>getAnimations()普通取得所有的Animation組件4publiclonggetDuration()普通取得動(dòng)畫的持續(xù)時(shí)間5publiclonggetStartTime()普通取得動(dòng)畫的開始時(shí)間6publicvoidreset()普通重置動(dòng)畫7publicvoidsetDuration(longdurationMillis)普通設(shè)置動(dòng)畫的持續(xù)時(shí)間8publicvoidsetStartTime(longstartTimeMillis)普通設(shè)置動(dòng)畫的開始時(shí)間相關(guān)類與屬性AnimationSet2No.子類描述1AccelerateDecelerateInterpolator加速-減速,動(dòng)畫在開始與結(jié)束的地方執(zhí)行速度慢,而中間部分時(shí)加速2AccelerateInterpolator加速,動(dòng)畫在開始的時(shí)候執(zhí)行速度慢,然后開始加速3DecelerateInterpolator減速,動(dòng)畫在開始的時(shí)候執(zhí)行速度塊,然后開始減速4CycleInterpolator動(dòng)畫循環(huán)播放特定的次數(shù),速率改變沿著正弦曲線變化5LinearInterpolator動(dòng)畫以勻速的方式運(yùn)行相關(guān)類與屬性Interpolator子類

3相關(guān)類與屬性AnimationListener4No.方法描述1publicabstractvoidonAnimationStart(Animationanimation)動(dòng)畫開始時(shí)觸發(fā)2publicabstractvoidonAnimationRepeat(Animationanimation)動(dòng)畫重復(fù)時(shí)觸發(fā)3publicabstractvoidonAnimationEnd(Animationanimation)

動(dòng)畫結(jié)束時(shí)觸發(fā)No.可配置的元素描述1<set>為根節(jié)點(diǎn),定義全部的動(dòng)畫元素2<alpha>定義漸變動(dòng)畫效果3<scale>定義縮放動(dòng)畫效果4<translate>定義平移動(dòng)畫效果5<rotate>定義旋轉(zhuǎn)動(dòng)畫效果XML配置屬性標(biāo)簽1No.可配置的屬性數(shù)據(jù)類型描述1android:durationlong動(dòng)畫持續(xù)時(shí)間,毫秒單位2android:fillAfterboolean動(dòng)畫轉(zhuǎn)化是否在動(dòng)畫結(jié)束后被應(yīng)用3android:fillBeforeboolean動(dòng)畫轉(zhuǎn)化是否在動(dòng)畫開始前被應(yīng)用4android:interpolatorString動(dòng)畫加速器:accelerate_decelerate_interpolator(加速-減速)accelerate_interpolator(加速)decelerate_interpolator(減速)5android:repeatCountint動(dòng)畫重復(fù)執(zhí)行的次數(shù)6android:repeatModeString動(dòng)畫重復(fù)的模式(restart、reverse)7android:startOffsetlong動(dòng)畫之間的間隔8android:zAdjustmentint動(dòng)畫ZOrder配置:0(保持不變)1(保持最上層)-1(保持最下層)9android:interpolatorString指定動(dòng)畫的執(zhí)行速率通用配置屬性2XML配置屬性實(shí)例演示publicclassFrameAnimationAcextendsActivity{Buttonbutton=null;ImageViewimgView=null;@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.frame);imgView=(ImageView)findViewById(R.id.imageView);button=(Button)findViewById(R.id.button1);button.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){AnimationSetset=newAnimationSet(true);

AlphaAnimationalpha=newAlphaAnimation(1,0.1f);set.setInterpolator(newAccelerateInterpolator());

set.addAnimation(alpha);

set.setDuration(3000);imgView.startAnimation(set);}});

}AnimationSet構(gòu)造AnimationSet中可添加多個(gè)動(dòng)畫效果對(duì)象,構(gòu)造復(fù)雜動(dòng)畫效果編碼實(shí)現(xiàn)1<?xml

version="1.0"

encoding="utf-8"?><set

xmlns:android="/apk/res/android"> <alpha

xmlns:android="/apk/res/android"

android:fromAlpha="1.0"

android:toAlpha="0.1"

android:duration="3000"

android:fillBefore="true">

</alpha></set>XML配置動(dòng)畫序列res/anim/alpha.xml實(shí)例演示XML配置2可將多個(gè)動(dòng)畫效果標(biāo)簽進(jìn)行組合,構(gòu)造復(fù)雜動(dòng)畫實(shí)例演示publicclassFrameAnimationAcextendsActivity{Buttonbutton=null;ImageViewimgView=null;@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.frame);imgView=(ImageView)findViewById(R.id.imageView);button=(Button)findViewById(R.id.button1);button.setOnClickListener(newOnClickListener(){@Override

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論