Layer and animation Knowledge points Summary
1.Core Animation
Non-entertainment software will use the animation, easy to operate.
2.Quartz 2D Drawing
is a 2D drawing engine.
- (1) Drawing context is a target object of a drawing that defines the basic properties of the drawing, such as color, plot range, line width, and style.
- (2) through the UIView will create the context, you can use a statement similar to the following to get the current context.
Cgcontextref CurrentContext = Uigraphicsgetcurrentcontext ();
- (3) If you want to save the current state before modifying it, you can use Uigraphicspushcontext;
To restore a saved context, the Uigraphicspopcontext is available.
- (4) path, which is a curve or polyline identified with a series of coordinate points, is created so that you can draw lines along it, or fill the enclosed space.
3.OpenGL ES Programming
It is generally three steps:
- (2) Send the contents of the context into framebuffer
4.Metal (underlying API)
Apple's latest metal framework supports GPU hardware acceleration, advanced 3D Graphics rendering, and big data parallel operations. It provides an advanced and streamlined API to ensure the fine-grained size of the framework (Fine-grain), and supports underlying control over the management of organizational architecture, program processing, graphics rendering, operational directives, and instruction-related data resources. Its core purpose is to reduce CPU overhead as much as possible, while most of the load generated at runtime is assumed by the GPU. --metal Programming Guide
Here is a summary of some technical issues encountered in development
/************************************************************************************************************** /
Copy: Copy a layer based on the corresponding property
1Careplicatorlayer *re =[Careplicatorlayer layer];2 3Re.frame =self.drawView.bounds;4 5 6 7Re.instancecount =5;8 9Re.instancetransform = Catransform3dmaketranslation ( -,0,0);Ten One A -Re.instancedelay =0.5; - the - - //Re.instancecolor = [Uicolor colorwithwhite:1 alpha:0.2]. Cgcolor; - + - +[Self.drawView.layer Addsublayer:re];
Gradients: Assigning a color layout gradient in a view
1Cagradientlayer *gra =[Cagradientlayer layer];2 3_gra =GRA;4 5Gra.frame =_imgbottom.bounds;6 7 8 9Gra.startpoint = Cgpointmake (0,0);Ten OneGra.endpoint = Cgpointmake (0,1); A - - theGra.colors = @[(ID) [Uicolor Whitecolor]. Cgcolor, (ID) [Uicolor Graycolor]. Cgcolor]; - - - +Gra.opacity =0; - + A at [_imgbottom.layer Addsublayer:gra]; - -
: Capture screen area as picture save
1 /**2 3 * Generate4 5 */6 7- (void) Createscreenshot8 9 {Ten OneUigraphicsbeginimagecontextwithoptions (Self.view.frame.size, YES,0.0); A - [Self.view.layer Renderincontext:uigraphicsgetcurrentcontext ()]; - theUIImage *image =Uigraphicsgetimagefromcurrentimagecontext (); - - [Self.images addobject:image]; - + } - +
Quickly merge two pictures;
1 /**2 3 * First set two pictures, and the width of the space and the width of the picture, the height is equal to half of the picture, using the following method to achieve the rapid merging of two pictures4 5 */6 7 8 9 //set the scope of contentTen One_imgtop.layer.contentsrect = CGRectMake (0,0,1,0.5); A -_imgbottom.layer.contentsrect = CGRectMake (0,0.5,1,0.5); - the - - //Setting the anchor point makes the move - +_imgtop.layer.anchorpoint = Cgpointmake (0.5,1); - +_imgbottom.layer.anchorpoint = Cgpointmake (0.5,0); A at - -
Three-dimensional: far small near large effect
1Catransform3d trans =catransform3didentity;2 3 4 5CGFloat d = -;6 7 8 9TRANS.M34 =-1/D;Ten One A - - thetrans = Catransform3dmakerotation (-angle,1,0,0); - - - +Self.imgTop.layer.transform =Trans; - +
iOS Development--Animation OC Chapter & Knowledge Point Summary