IOS各種動畫

2021-06-08 22:20:15 字數 3837 閱讀 6842

1。

[html]view plain

copy

uibezierpath *movepath = [uibezierpath bezierpath];  

[movepath movetopoint:center];  

[movepath addquadcurvetopoint:topos  

controlpoint:cgpointmake(topos.x, center.y)];  

cakeyframeanimation *moveanim = [cakeyframeanimation animationwithkeypath:@"position"];  

moveanim.path = movepath.cgpath;  

moveanim.removedoncompletion = yes;      

cabasicanimation *shrink = [cabasicanimation animationwithkeypath:@"transform.scale"];  

shrink.fromvalue = [nsnumber numberwithdouble:0.1];  

shrink.tovalue = [nsnumber numberwithdouble:12.0];  

shrink.fillmode=kcafillmodeforwards;  

shrink.removedoncompletion=yes;  

cabasicanimation *opacityanim = [cabasicanimation animationwithkeypath:@"opacity"];  

opacityanim.fromvalue = [nsnumber numberwithfloat:1.0];  

opacityanim.tovalue = [nsnumber numberwithfloat:0.0];  

opacityanim.removedoncompletion = yes;  

caanimationgroup *animgroup = [caanimationgroup animation];  

animgroup.animations = [nsarray arraywithobjects:moveanim, shrink,opacityanim, nil];  

animgroup.duration = 1.0;  

animgroup.delegate = self;  

[thelayer addanimation:animgroup forkey:nil];  

2。 [html]view plain

copy

catransition* animation = [catransition animation];  

[animation settype:kcatransitionmovein];  

[animation setsubtype:kcatransitionfromleft];  

[animation settimingfunction:[camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout]];  

[animation setduration:1.0f];  

animation.delegate = self;  

[self.preshowlayer addanimation:animation forkey:@"detailanimated"];  

3。 [html]view plain

copy

[uiview beginanimations:@"entercomment" context:nil];  

[uiview setanimationduration:0.3];  

[uiview setanimationdelegate:self];  

sendcommentview.frame = cgrectmake(sendcommentview.frame.origin.x, 480, sendcommentview.frame.size.width, sendcommentview.frame.size.height);  

[uiview commitanimations];  

4。 [html]view plain

copy

[uiview beginanimations:@"switch321view" context:nil];  

[uiview setanimationduration:0.3f];  

[uiview setanimationcurve:uiviewanimationcurveeaseinout];  

//[uiview setanimationdelegate:self];  

[uiview setanimationtransition:uiviewanimationtransitionflipfromright forview:self.animation321view cache:yes];  

[uiview commitanimations];  

5。 [html]view plain

copy

[uiview beginanimations:@"switch321view" context:nil];  

[uiview setanimationduration:0.3f];  

[uiview setanimationcurve:uiviewanimationcurveeaseinout];  

//[uiview setanimationdelegate:self];  

[uiview setanimationtransition:uiviewanimationtransitionflipfromright forview:self.animation321view cache:yes];  

[uiview commitanimations];  

[uiview animatewithduration:0.3 animations:^ completion:^(bool finished) ];   6.

[html]view plain

copy

[uiview transitionwithview: self.view  

duration:1.0   

options:uiviewanimationoptiontransitionflipfromleft  

animations:^  

completion:nil];  

[html]view plain

copy

[uiview transitionfromview:(displayingprimary ? primaryview : secondaryview)    

toview:(displayingprimary ? secondaryview : primaryview)    

duration:1.0    

options:(displayingprimary ? uiviewanimationoptiontransitionflipfromright :    

uiviewanimationoptiontransitionflipfromleft)    

completion:^(bool finished)     

}];  

ios各種動畫效果

最普通動畫 開始動畫 uiview beginanimations nil context nil 設定動畫持續時間 uiview setanimationduration 2 動畫的內容 frame.origin.x 150 img setframe frame 動畫結束 uiview commi...

iOS 動畫 UIView動畫

viewcontroller.m ui 23 動畫 import viewcontroller.h inte ce viewcontroller property strong,nonatomic iboutlet uiview opeview1 property strong,nonatomic ...

iOS 動畫總結 UIView動畫

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