Related information:
This theory is much more: http://www.360doc.com/content/15/0727/09/20918780_487655250.shtml
This practice is more, the common effect has http://www.cnblogs.com/wengzilin/p/4250957.html
Example: magnification effect. The idea is to let Calayer move, Cabasicanimation is how to move, and then add the animation to Calayer
//actor InitializationCalayer *scalelayer =[[Calayer alloc] init]; Scalelayer.backgroundcolor=[Uicolor Bluecolor]. Cgcolor; Scalelayer.frame= CGRectMake ( -, -, -, -); Scalelayer.cornerradius=Ten; [Self.view.layer Addsublayer:scalelayer]; //set the script .Cabasicanimation *scaleanimation = [cabasicanimation animationwithkeypath:@"Transform.scale"]; Scaleanimation.fromvalue= [NSNumber numberwithfloat:1.0]; Scaleanimation.tovalue= [NSNumber numberwithfloat:1.5]; Scaleanimation.autoreverses=YES; Scaleanimation.fillmode=kcafillmodeforwards; Scaleanimation.repeatcount=maxfloat; Scaleanimation.duration=0.8; //The curtain[Scalelayer addanimation:scaleanimation Forkey:@"scaleanimation"];
Think: Create a new calayer here, but if I want to get a uiview on the interface (maybe a button, a picture, etc.).
In fact, all views inherit UIView, and each UIView has calayer properties (see the first reference for a description)
So, we can add animations directly to the layer of the view. This makes the code easier to understand.
Here's an example of a view rotation, isn't it?
UIView *v = [[UIView alloc]initwithframe:cgrectmake ( $, -, -, -)]; V.backgroundcolor=[Uicolor Redcolor]; [Self.view Addsubview:v]; Cabasicanimation*an2 = [Cabasicanimation animationwithkeypath:@"transform.rotation"]; An2.fromvalue=0; An2.tovalue= [NSNumber numberwithfloat:m_pi*2]; An2.repeatcount=maxfloat; An2.duration=0.8; [V.layer addanimation:an2 Forkey:@"Caan"];
IOS Core Animation Cores Animation