(four issue) simple add Tableviewcell 3D animation effect

Source: Internet
Author: User

-(void) TableView: (UITableView *) TableView Willdisplaycell: (UITableViewCell *) cell Forrowatindexpath: (Nsindexpath *) indexpath{ //Reference: HTTP://BEYONDVINCENT.COM/2014/01/13/2014-01-13-ANIMATION-TABLEVIEW-CELL/ //1, Configure Catransform3d content      Catransform3d transform;    // The Catransform3dmakerotation function creates a transition that rotates the layer in a three-dimensional axis coordinate system in any radian.      transform = catransform3dmakerotation ((90.0*M_PI)/180, 0.0, 0.7, 0.4);   //& nbsp;  //transform = catransform3dmakerotation (0.78, 0.0, 0.7, 0.4);   //    //transform = catransform3dmakerotation (radians (45.0), 0.0, 1.0, 0.0);   /*   & nbsp Parameters: The first parameter is the angle of rotation, the object is rotated at the shortest distance from the angle you set, and the following three parameters are a vector value represented by the value of XYZ ( -1~1)       A,       //rotation along y-axis       transform = catransform3dmakerotation ((90.0*M_PI)/180, 0.0 , 1.0, 0.0);     //rotate along the x-axis       transform = catransform3dmakerotation ((90.0*M_PI)/180, 1.0, 0.0, 0.0);      //rotation along Z axis       transform = catransform3dmakerotation ((90.0*M_PI)/180, 0.0, 0.0, 1.0);      B,       0.78, used in the previous example, is calculated by the angle value is converted to a radian value. To convert the angle value to a radian value, you can use a simple formula mπ/180.       for example, 45π/180 = 45 (3.1415)/180 = 0.7853.       double radians (float degrees) {      return (degrees * 3.14159265)/180.0;     }     //When you create a conversion, you will call this method:       transform = catransform3dmakerotation (radians (45.0), 0.0, 1.0, 0.0);       */     transform.m34 = 1.0/ -600;    /*    The structure of    transform is as follows:      struct catransform3d      {       Related Information:http://blog.csdn.net/ch_soft/article/details/7351896/       CGFloat M11, M12, M13, m14;      cgfloat M21, M22, M23, m24;    & nbsp CGFloat M31, M32, M33, m34;      cgfloat M41, M42, M43, m44;     };& nbsp;     Brief Introduction:      first to achieve the view (layer) of the perspective effect (that is, nearly large and small), is by setting the M34:       Catransform3d rotationandperspectivetransform = catransform3didentity;       ROTATIONANDPERSPECTIVETRANSFORM.M34 = 1.0/ -500;      M34 is responsible for the z-axis translation (move), m34= -1/d,  default value is 0, that is, D infinity, which means layer in projection plane (projection face) and layer in the world The coordinate coincide.       d The smaller the perspective effect, the more obvious.       the so-called D is the distance from the eye (Observer) to the projection plane.       */  //2. Defines the initial state of the cell      /* shadow color. The default is opaque black. Color created from the currentThe mode is not supported. Can be made into animations. */     Cell.layer.shadowColor = [[Uicolor blackcolor]cgcolor];    /* Shadow offset. The default is (0,-3). Can be made into animations. */     Cell.layer.shadowOffset = Cgsizemake (Ten);     cell.alpha = 0;      Cell.layer.transform = transform;    /* Defines the anchor point of the bounding rectangle of the layer, points on the normalized layer coordinates-' (0,0) The bottom left corner of the bounding rectangle "(") is the upper right corner. The default is ' (0.5,0.5) ', which is the center of the bounding rectangle, which can be animated. */     cell.layer.anchorPoint = cgpointmake (0, 0.5);    //3. Define the final state of the cell and submit the animation       [UIView beginanimations:@ "transform" context:null];      [UIView setanimationduration:0.5];//slow motion      Cell.layer.transform = catransform3didentity;/* Returns True if ' t ' is the identity transform. What do you mean by restoring? */     Cell.alpha = 1;     cell.layer.shadowOffset = cgsizemake (0, 0);  & nbsp;   cell.frame = CGRectMake (0, CELL.FRAME.ORIGIN.Y, cell.Frame.size.width, Cell.frame.size.height);     [UIView commitanimations];}

(phase Four) simple add Tableviewcell 3D animation effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.