IOS Animation Preliminary

Source: Internet
Author: User

IOS Animation Preliminary

1. The use of Calayer (layer) belongs to the quartzcore.framework Framework cross-platform

The controls inside the uikit.framework we used in development were visible, mainly because he had calayer.

1   //-------------------------------------------------------------------------2     //Layer Section Properties3     4     //Shadow is transparent5Self.myView.layer.shadowOpacity =1.0f;6     7     //Shadow color8Self.myView.layer.shadowColor =[Uicolor Redcolor]. Cgcolor;9     Ten     //Shadow Radius OneSelf.myView.layer.shadowRadius =10.0f; A      -     //fillet radius of layer -Self.myView.layer.cornerRadius =5; the      -     //Layer Border Color -_myview.layer.bordercolor =[Uicolor Whitecolor]. Cgcolor; -      +     //Layer Border Radius -_myview.layer.borderwidth =Ten; +     //-------------------------------------------------------------------------

Calayer animated when setting part of a property, (hidden test animation) has a animatable related comment and comes with a hidden test animation

Such as:

1 /*  */23@property cgsize shadowoffset; 4 5 /* animatable */ 6 7 @property cgfloat Shadowradius;

Use of Calayer

1Calayer *lay =[Calayer layer];2Lay.backgroundcolor =[Uicolor Redcolor]. Cgcolor;3Lay.shadowopacity =1.0;4Lay.shadowcolor =[Uicolor Whitecolor]. Cgcolor;5Lay.shadowradius =Ten;6Lay.cornerradius =5;7Lay.maskstobounds =YES;8 [Self.view.layer Addsublayer:lay];9     Ten     //Set Image OneLay.contents = (__bridgeID_nullable) ([UIImage imagenamed:@"111"]. Cgimage);

Calayerd animations (use Catransform3d, usually do not animate this method)

1     //Rotary Rotation2[UIView animatewithduration:0.3animations:^{3_layer.transform = Catransform3dmakerotation (M_pi_4,0,0,0);4         5         //KVC6[_layer setvalue:[nsvalue valuewithcatransform3d:catransform3dmakerotation (M_pi_4,0,0,0)] Forkeypath:@"Transform"];7 8         //KVC transform.rotation9[_layer setValue: @M_PI forkeypath:@"transform.rotation"];Ten  One     }]; A      -     //Zoom to zoom out scale -[UIView animatewithduration:0.3animations:^{ the          -_layer.transform = Catransform3dmakescale (0,0,0); -          -         //KVC +[_layer Setvalue:[nsvalue Valuewithcatransform3d:catransform3dmakescale (0,0,0)] Forkeypath:@"Transform"]; -     }]; +      A     //Pan translation at[UIView animatewithduration:0.3animations:^{ -  -_layer.transform = Catransform3dmaketranslation (0,0,0); -  -         //KVC -[_layer Setvalue:[nsvalue Valuewithcatransform3d:catransform3dmaketranslation (0,0,0)] Forkeypath:@"Transform"]; in          -[_layer Setvalue:[nsvalue Valuewithcatransform3d:catransform3dmaketranslation (0,0,0)] Forkeypath:@"transform.x"]; to  +     }]; -      the     // ... Catransform3dmakeaffinetransform *[UIView animatewithduration:0.3animations:^{ $         Panax Notoginseng_layer.transform = Catransform3dmakeaffinetransform (Cgaffinetransformmake (0,0,0,0,0,0)); -          the         //KVC +[_layer setvalue:[nsvalue Valuewithcatransform3d:catransform3dmakeaffinetransform (CGAffineTransformMake (0,0,0,0,0,0)] Forkeypath:@"Transform"]; A}];

IOS Animation Preliminary

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.