iOS 學習總結之動畫

2021-06-23 08:01:09 字數 3089 閱讀 5808

[objc]view plain

copy

uiview的,翻轉、旋轉,偏移,翻頁,縮放,取反的動畫效果  

翻轉的動畫  

//開始動畫

[uiviewbeginanimations

:@"doflip"

context

:nil

];  

//設定時常

[uiviewsetanimationduration:1

];  

//設定動畫淡入淡出

[uiviewsetanimationcurve

:uiviewanimationcurveeaseinout];  

//設定**

[uiviewsetanimationdelegate

:self

];  

//設定翻轉方向

[uiviewsetanimationtransition

:  uiviewanimationtransitionflipfromleft forview

:manimageview

cache

:yes

];  

//動畫結束

[uiviewcommitanimations

];  

旋轉動畫  

建立乙個cgaffinetransform  transform物件  

cgaffinetransform  transform;   

//設定旋轉度數

transform = cgaffinetransformrotate(manimageview.transform

,m_pi/6.0

);  

//動畫開始

[uiviewbeginanimations

:@"rotate"

context

:nil

];  

//動畫時常

[uiviewsetanimationduration:2

];  

//新增**

[uiviewsetanimationdelegate

:self

];  

//獲取transform的值

[manimageviewsettransform

:transform];  

//關閉動畫

[uiviewcommitanimations

];  

偏移動畫  

[uiviewbeginanimations

:@"move"

context

:nil

];  

[uiviewsetanimationduration:2

];  

[uiviewsetanimationdelegate

:self

];  

//改變它的frame的x,y的值

manimageview.frame

=cgrectmake(10

0,10

0, 12

0,10

0);  

[uiviewcommitanimations

];  

翻頁動畫  

[uiviewbeginanimations

:@"curlup"

context

:nil

];  

[uiviewsetanimationcurve

:uiviewanimationcurveeaseinout];

//指定動畫曲線型別,該列舉是預設的,線性的是勻速的

//設定動畫時常

[uiviewsetanimationduration:1

];  

[uiviewsetanimationdelegate

:self

];  

//設定翻頁的方向

[uiviewsetanimationtransition

:uiviewanimationtransitioncurlup

forview

:manimageview

cache

:yes

];  

//關閉動畫

[uiviewcommitanimations

];  

縮放動畫  

cgaffinetransform  transform;  

transform = cgaffinetransformscale(manimageview.transform,1

.2,1.2

);  

[uiviewbeginanimations

:@"scale"

context

:nil

];  

[uiviewsetanimationduration:2

];  

[uiviewsetanimationdelegate

:self

];  

[manimageviewsettransform

:transform];  

[uiviewcommitanimations

];  

取反的動畫效果是根據當前的動畫取他的相反的動畫  

cgaffinetransform transform;  

transform=cgaffinetransforminvert(manimageview.transform

);  

[uiviewbeginanimations

:@"invert"

context

:nil

];  

[uiviewsetanimationduration:2

];//動畫時常

[uiviewsetanimationdelegate

:self

];  

[manimageviewsettransform

:transform];

//獲取改變後的view的transform

[uiviewcommitanimations

];//關閉動畫

ios 學習總結之動畫

uiview的,翻轉 旋轉,偏移,翻頁,縮放,取反的動畫效果 翻轉的動畫 開始動畫 uiview beginanimations doflip context nil 設定時常 uiview setanimationduration 1 設定動畫淡入淡出 uiview setanimationcur...

IOS 動畫總結

uiview動畫使用iphone作為開發平台,你可以體驗到uiview帶來的既另類又有趣的動畫功能,這個功能可以在更新檢視時放緩節奏,產生流暢的動畫效果,進而改善使用者體驗。可以產生動畫效果的變化包括 1 frame 基於父檢視的位置和大小 2 bounds 改變檢視的框架和邊界 3 center ...

iOS 動畫總結

1.概述 uikit直接將動畫整合到uiview類中,實現簡單動畫的建立過程。uiview類定義了幾個內在支援動畫的屬性宣告,當這些屬性發生改變時,檢視為其變化過程提供內建的動畫支援。執行動畫所需要的工作由uiview類自動完成,但仍要在希望執行動畫時通知檢視,為此需要將改變屬性的 包裝到乙個 塊中...