Today Bo Master has an animation animation demand, encountered some difficulties, here and we share, hope to progress together.
There are two types of animations in iOS development: a uiview animation, also known as an implicit animation, and a change in the value of the frame after the animation. The other is Calayer animation, also known as display animation, the model layer after the animation data will not change, the graphics back to the original position. But in actual development, Because UIView can interact with the corresponding user, so UIView animation with more.
I. Animation of UIView
1. Implementation mode: Animation block, block
Begin
Animating effects modifying property values, animation duration, etc.
Conmmit
2. Property animation, transition animation
① Property Animation Support 6 kinds: Transform structure body 6
② Transition Animation: Container view, two sub-views
Two. Calayer animation = = Core Animation = = Caanimation Animation
Caanimation Abstract class
Animation
①.caanimationgroup Combo Animation
②.catransition Transition Animation
③.capropertyanimation Property Animation (properties of Layer)
Animationwithkeypath
Cabasicanimation Basic Animations
Fromvalue Tovalue
Cakeyframeanimation Key-Frame animations
Values
The following posted UIView animation code, share with you, Calayer animation, that is, core animation you crossing can own Baidu.
1.
Animating with animation blocks
Start animating the first parameter: the name of the animation the second parameter: can be used to pass a value
[UIView beginanimations:@ "haha" context:nil];
Set the duration of the animation
[UIView setanimationduration:1.5];
[UIView Setanimationrepeatautoreverses:yes];
To set the properties of a view as required
_showview.backgroundcolor=[uicolor Graycolor];
_showview.center=cgpointmake (200, 200);
Commit animation settings, start animation
[UIView commitanimations];
2.
Animating with block
[UIView animatewithduration:1.5 animations:^{
Animation effect Settings
_showview.backgroundcolor=[uicolor Yellowcolor];
Delay
[UIView setanimationdelay:1.0];
View movement can be implemented by setting transform
} completion:^ (BOOL finished) {
Settings after the animation is complete
NSLog (@ "animation complete");
}];
iOS Development diary 16-animation animation