iosiphone開發(fā)入門教程源碼和15動(dòng)畫_第1頁
iosiphone開發(fā)入門教程源碼和15動(dòng)畫_第2頁
iosiphone開發(fā)入門教程源碼和15動(dòng)畫_第3頁
iosiphone開發(fā)入門教程源碼和15動(dòng)畫_第4頁
iosiphone開發(fā)入門教程源碼和15動(dòng)畫_第5頁
免費(fèi)預(yù)覽已結(jié)束,剩余19頁可下載查看

下載本文檔

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

文檔簡介

第十五講動(dòng)畫主要知識CoreAnimation動(dòng)畫介在iOS中動(dòng)畫實(shí)現(xiàn)技術(shù)主要是:CoreAnimationCoreAnimation負(fù)責(zé)所有的滾動(dòng)、旋轉(zhuǎn)、縮小和是CoreAnimation中的圖層。CoreAnimation基CoreAnimation創(chuàng)建動(dòng)畫時(shí)候會(huì)修改CALayer屬性,然后讓這些屬性流暢地變化。CoreAnimation相關(guān)知識點(diǎn): 圖層,圖層是動(dòng)畫發(fā)生的地方,CALayer總是與UIView關(guān)聯(lián),過layer屬 隱式動(dòng)畫,這是一種最簡單的動(dòng)畫,不用設(shè)置定時(shí)器,不用慮線程或者重畫 顯式動(dòng)畫,是一種使用CABasicAnimation創(chuàng)建的動(dòng)畫,通CABasicAnimation 關(guān)鍵幀動(dòng)畫,這是一種更復(fù)雜的顯式動(dòng)畫類型,這里動(dòng)畫的起點(diǎn)和終點(diǎn),還可以定義某些幀之間的動(dòng)隱式動(dòng)畫實(shí)關(guān)鍵代[UIViewbeg=ormmoveTransform[ne.layer.opacity=1;}說飛機(jī) ne.layer.opacity=1; 飛 顯式動(dòng)畫實(shí)關(guān)鍵代- CABasicAnimation*opAnim=[CABasicAnimationopAnim.toValue=[NSNumbernumberWithFloat:1.0];opAnim.cumulative=YES;opAnim.repeatCount= ne.layeraddAnimation:opAnimCGAffineTransformmoveTransform=CGAffineTransformMakeTranslation(180,200);moveAnim.duration=6.0;moveAnim.toValue=[NSValue ne.layeraddAnimation:moveAnim}說顯式動(dòng)畫時(shí)候,不必定義CALayer的變化,也不必執(zhí)行[CABasicAnimation獲 opAnim.repeatCount重復(fù)執(zhí)行次CATransform3DMakeAffineTransform函數(shù)是將仿射變換矩陣變成CoreAnimation使用的Transform3D類型的矩關(guān)鍵幀顯式動(dòng)畫實(shí) opAnim.duration=opAnim.values=[NSArray[NSNumbernumberWithFloat:1.0],opAnim.keyTimes=[NSArray[NSNumbernumberWithFloat:0.0],[NSNumbernumberWithFloat:0.5], ne.layeraddAnimation:opAnimCGAffineTransformmoveTransform=CGAffineTransformMakeTranslation(180,200);moveAnim.duration=6.0; }說,取值范圍0.0-1.0之間關(guān)鍵 徑實(shí)-(IBAction)drawStar:(id)sender[drawButtonCGMutablePathRefstarPath=CGPathCreateMutable();CGPathMoveToPoint(starPath,NULL,160.0f,100.0f);CGPathAddLineToPoint(starPath,NULL,260.0,170.0);CAKeyframeAnimation*animation=[animationsetDuration:10.0f];[animationstarPath=nil;}[drawButton}說[CAKeyframeAnimationCGPathCloseSubpath(starPath);結(jié)束路徑[animationsetPath:starPath];[animationsetDelegate:self];設(shè)置委托對象為本身,即回調(diào)方法animationDidStop:finished:。最后CFRelease(starPath);UIView級別動(dòng)除了直接使用CoreAnimationh文@interface@interfaceMainViewController:{UIImageViewUIButton}@property(assign)IBOutletUIImageView--(IBAction)action:(id)sender[UIViewbeginAnimations:@"HideButton"context:nil];[[selfbutton]setAlpha:0.0];[UIView[UIView[UIView[UIView[UIViewCGPointcenter=[[selfanimImageView]center];center.y+=100;[UIView}[UIViewbeginAnimations:@"ShowButton"context:nil];[[selfbutton]setAlpha:1.0];[UIView}說beginAnimations:context:開始,在UIView首先開始將按鈕設(shè) [UIView內(nèi)置UIView動(dòng)UIView具有一個(gè)UIViewAnimationTransition屬性可以設(shè)定 實(shí)-[UIViewsetAnimationDuration:0.5f];UIButton*theButton=(UIButton*)sender;switch(theButton.tag){casecasec

溫馨提示

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

評論

0/150

提交評論