1. When we create animations using core animatioin, we essentially change the properties of the Calayer and then let these properties flow smoothly. You can animate using the location, color, transparency, and cgaffine transformations of the core animation objects.
2, a simple small animation
/Implicit animation/
-(void) viewdidload {
[Super viewdidload];
uiimageview *imageview = [[uiimageview alloc] initwithframe:cgrectmake( 0, 0, (+ ))];
[UIView beginanimations:nil context:NULL];
[UIView setanimationduration:2.0]; // set animation duration
cgaffinetransform movetransform = cgaffinetransformmaketranslation( 300 ); // move to a fixed position
[ImageView. layer setaffinetransform: movetransform];
ImageView. layer. Opacity = 1;
[UIView commitanimations];
ImageView. backgroundcolor = [uicolor redcolor];
[self. View addsubview: ImageView];
}
/Show Animation/
-(void) viewdidload {
[Super viewdidload];
uiimageview *imageview = [[uiimageview alloc] initwithframe:cgrectmake( 0, 0, (+ ))];
ImageView. backgroundcolor = [uicolor redcolor];
cabasicanimation *opanim = [cabasicanimation animationwithkeypath:@ "opacity"];
Opanim. Duration = 3.0;
// define start and end transparency
Opanim. fromvalue = [nsnumber numberwithfloat:1.0];
Opanim. tovalue = [nsnumber numberwithfloat:0];
Opanim. cumulative = YES;
Opanim. repeatcount = 6; // number of repetitions
[ImageView. layer addanimation: Opanim forkey:@ "animateopacity"];
cgaffinetransform movetransform = cgaffinetransformmaketranslation( 300 );
cabasicanimation *moveanim = [cabasicanimation animationwithkeypath:@ "transform "];
Moveanim. Duration = 6.0;
Moveanim. tovalue = [nsvalue valuewithcatransform3d:catransform3dmakeaffinetransform( Movetransform)];
[ImageView. layer addanimation: Moveanim forkey:@ "Animatetransform"];
[self. View addsubview: ImageView];
About Core Animation