IOS: Introduction to specific classes and protocols for core animations

Source: Internet
Author: User
<span id="Label3"></p><p><p><span style="font-size: 16px;"><span style="font-size: 18px;"><span style="font-family: ‘courier new‘, courier;">Core Animation classes</span> :</span><span style="font-family: arial, helvetica, sans-serif; font-size: 18px;">caanimation</span></span><span style="font-family: ‘courier new‘, courier; font-size: 18px;">,</span><span style="font-family: ‘Hannotate SC‘; font-size: large;">capropertyanimation, cabasicanimation, cakeyframeanimation, catransition, Caanimationgroup</span></p></p><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="font-family: ‘Hannotate SC‘; font-size: large;"> </span></span><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="font-family: ‘Hannotate SC‘; font-size: large;">parent class: caanimation (abstract Class)</span></span><span style="font-size: 18px; font-family: ‘courier new‘, courier;"><span style="font-size: 18px; font-family: ‘courier new‘, courier;">caanimation Direct sub-class: capropertyanimation (abstract class), catransition (transition animation), caanimationgroup (animation array)</span></span><span style="font-size: 18px; font-family: ‘courier new‘, courier;"><span style="font-size: 18px; font-family: ‘courier new‘, courier;">capropertyanimation Direct sub-class: cabasicanimation (basic animation), cakeyframeanimation (keyframe Animation)</span></span><span style="font-family: ‘Hannotate SC‘; font-size: large; color: #ffcc99;"><span style="font-family: ‘Hannotate SC‘; font-size: large; color: #ffcc99;">=========================================================</span></span><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="font-family: ‘Hannotate SC‘; font-size: large;"> </span></span><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="font-family: ‘Hannotate SC‘; font-size: large;">class Description:</span></span><p><p><span style="color: #ff53f6; font-family: ‘Hannotate SC‘; font-size: large;">@interface caanimation:nsobject <nscoding, nscopying, camediatiming, caaction></span> <span style="color: #ff3137; font-family: ‘Hannotate SC‘; font-size: large;">//animation Root abstract class</span></p></p><p><p><span style="color: #2a42fc; font-family: ‘Hannotate SC‘; font-size: large;">Speed control function (determines the rate at which the animation Runs)</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;">@property (strong) camediatimingfunction *timingfunction;</span></p></p><p><p><span style="color: #314bfc; font-family: ‘Hannotate SC‘; font-size: large;">Proxy for animations</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;">@property (strong) ID delegate;</span></p></p><p><p><span style="color: #1d4dfc; font-family: ‘Hannotate SC‘; font-size: large;">The default is yes, which is removed from the layer after the animation has finished executing, and the shape reverts to the state before the animation is Executed.</span></p></p><p><p><span style="font-size: large; font-family: ‘courier new‘, courier;">@property (getter=isremovedoncompletion) BOOL removedoncompletion;</span></p></p><p><p><span style="color: #273bfc; font-size: large;">class method to create an animated instance</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;">+ (instancetype) animation;</span></p></p><p><p><span style="color: #2335fc; font-family: ‘Hannotate SC‘; font-size: large;">Gets the corresponding property value according to the specified key</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;">+ (id) defaultvalueforkey: (nsstring *) key;</span></p></p><p><p><span style="color: #2637fc; font-family: ‘Hannotate SC‘; font-size: large;">Gets the corresponding property according to the specified key is archived</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;">-(BOOL) shouldarchivevalueforkey: (nsstring *) key;</span></p></p><p><p><span style="color: #fa56fc; font-family: ‘Hannotate SC‘; font-size: large;">@end</span></p></p><p><p></p></p><p><p><span style="color: #ffcc99;">=========================================================</span></p></p><p><p></p></p><p><p><span style="color: #f345d6; font-family: ‘Hannotate SC‘; font-size: large;">@interface nsobject (caanimationdelegate)</span> <span style="color: #ff363c; font-size: 18px; font-family: ‘courier new‘, courier;">an animation protocol classification for The//nsobject class</span></p></p><p><p><span style="color: #3d62ff; font-family: ‘Hannotate SC‘; font-size: large;">The method that fires when the animation starts</span></p></p><p><p><span style="color: #01010e; font-family: ‘Hannotate SC‘; font-size: large;">-(void) animationdidstart: (caanimation *) anim;</span></p></p><p><p><span style="color: #2363ff; font-family: ‘Hannotate SC‘; font-size: large;">The method that fires when the animation is ended</span></p></p><p><p><span style="color: #01010e; font-family: ‘Hannotate SC‘; font-size: large;">-(void) animationdidstop: (caanimation *) anim finished: (BOOL) flag;</span></p></p><p><p><span style="color: #ff47df; font-family: ‘Hannotate SC‘; font-size: large;">@end</span></p></p><p><p><span style="color: #ff47df; font-family: ‘Hannotate SC‘; font-size: large;"></span></p></p><p><p><span style="color: #ffcc99; font-family: ‘Hannotate SC‘; font-size: large;">=========================================================</span></p></p><p><p></p></p><p><p><span style="color: #fe4df1; font-family: ‘Hannotate SC‘; font-size: large;">@interface capropertyanimation:caanimation</span> <span style="color: #fe3643; font-family: ‘Hannotate SC‘; font-size: large;">//abstract class, Creating an object must use its subclass</span></p></p><p><p><span style="color: #2b41fc; font-family: ‘Hannotate SC‘; font-size: large;">Creates an animated instance from a specified key path</span></p></p><p><p><span style="color: #000105; font-family: ‘Hannotate SC‘; font-size: large;">+ (instancetype) animationwithkeypath: (nsstring *) path;</span></p></p><p><p><span style="color: #394efc; font-family: ‘Hannotate SC‘; font-size: large;">The key path of the property</span></p></p><p><p><span style="color: #000105; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) NSString *keypath;</span></p></p><p><p><span style="color: #4849fc; font-family: ‘Hannotate SC‘; font-size: large;">Whether to add</span></p></p><p><p><span style="color: #000105; font-family: ‘Hannotate SC‘; font-size: large;">@property (getter=isadditive) BOOL additive;</span></p></p><p><p><span style="color: #3543fc; font-family: ‘Hannotate SC‘; font-size: large;">is cumulative</span></p></p><p><p><span style="color: #000105; font-family: ‘Hannotate SC‘; font-size: large;">@property (getter=iscumulative) BOOL cumulative;</span></p></p><p><p><span style="color: #3345fc; font-family: ‘Hannotate SC‘; font-size: large;">Animation deformation function (transform coefficient of Deformation)</span></p></p><p><p><span style="color: #000105; font-family: ‘Hannotate SC‘; font-size: large;">@property (strong) cavaluefunction *valuefunction;</span></p></p><p><p><span style="color: #fe49e9; font-family: ‘Hannotate SC‘; font-size: large;">@end</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;"></span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large; color: #ffcc99;">=========================================================</span></p></p><p><p></p></p><p><p><span style="color: #fe4df1; font-family: ‘Hannotate SC‘; font-size: large;">Note: There is one protocol to note in the core animation: camediatiming</span> <span style="color: #ff2c1b; font-family: ‘Hannotate SC‘; font-size: large;">//animation Protocol</span></p></p><p><p><span style="font-size: 18px; font-family: ‘courier new‘, courier;">Here are some of the properties (methods) that correspond to the protocol</span></p></p><p><p><span style="color: #2f64fc; font-family: ‘Hannotate SC‘; font-size: large;">Animation start time, used to set animation delay execution time</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;">@property Cftimeinterval beginTime;</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="color: #3f72fc;">Animation duration</span><br>@property Cftimeinterval duration;</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="color: #2953fc;">Animation execution Rate</span><br>@property float speed;</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="color: #385afc;">Time execution offset</span><br>@property Cftimeinterval timeoffset;</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="color: #3945fc;">Number of animation repetitions</span><br>@property float repeatcount;</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="color: #4044fc;">Animation repetition Time</span><br>@property Cftimeinterval repeatduration;</span></p></p><p><p><span style="font-family: ‘Hannotate SC‘; font-size: large;"><span style="color: #3c45fc;">If set to yes, the effect of each repetition of the animation will follow the last</span></span></p></p><p><p>@property BOOL autoreverses;</p></p><p><p><span style="color: #2955fc;"><span style="font-family: ‘Hannotate SC‘; font-size: large;">//animation Fill Mode</span> <span style="font-family: ‘courier new‘, courier; font-size: 18px;">(to Fillmode valid, You need to set removedoncompletion = NO)</span></span><span style="font-family: ‘Hannotate SC‘; font-size: large;"><br>@property (copy) NSString *fillmode;</span></p></p><p><p></p></p><p><p><span style="color: #ffcc99;">=========================================================</span></p></p><p><p></p></p><p><p><span style="color: #fd4ef9; font-family: ‘Hannotate SC‘; font-size: large;">@interface cabasicanimation:capropertyanimation</span> <span style="color: #fc2e27; font-family: ‘Hannotate SC‘; font-size: large;">//basic Animation</span></p></p><p><p><span style="color: #3445fa; font-family: ‘Hannotate SC‘; font-size: large;">Animate a property start value, final value, elapsed value (value may be the position of the animation position, deformation properties transform, etc.)</span></p></p><p><p><span style="color: #020001; font-family: ‘Hannotate SC‘; font-size: large;">@property (strong) ID fromvalue, tovalue, byvalue;</span></p></p><p><p><span style="color: #f449fa; font-family: ‘Hannotate SC‘; font-size: large;">@end</span></p></p><p><p></p></p><p><p><span style="color: #ffcc99;">=========================================================</span></p></p><p><p></p></p><p><p><span style="color: #fc55de; font-family: ‘Hannotate SC‘; font-size: large;">@interface cakeyframeanimation:capropertyanimation</span> <span style="color: #fc2822; font-family: ‘Hannotate SC‘; font-size: large;">//keyframe Animation</span></p></p><p><p><span style="color: #2a3cf9; font-family: ‘Hannotate SC‘; font-size: large;">An array that holds animation frames</span></p></p><p><p><span style="color: #010108; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) Nsarray *values;</span></p></p><p><p><span style="color: #294cf9; font-family: ‘Hannotate SC‘; font-size: large;">Animated motion Path</span></p></p><p><p><span style="color: #010108; font-family: ‘Hannotate SC‘; font-size: large;">@property Cgpathref path;</span></p></p><p><p><span style="color: #1d3fff; font-size: large;"><span style="font-family: ‘Hannotate SC‘;">//store An array of critical moments</span> , specifying a corresponding point in time for the corresponding keyframe with a value range of 0 to 1.0</span></p></p><p><p><span style="color: #010108; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) Nsarray *keytimes;</span></p></p><p><p><span style="font-family: ‘courier new‘, courier; font-size: 18px; color: #0000ff;">Speed control function (determines the rate at which the animation Runs)</span></p></p><p><p><span style="color: #010108; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) Nsarray *timingfunctions;</span></p></p><p><p><span style="color: #3a44f9; font-family: ‘Hannotate SC‘; font-size: large;">Calculation mode, for the connection mode between each frame</span></p></p><p><p><span style="color: #010108; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) NSString *calculationmode;</span></p></p><p><p><span style="color: #1c3af9; font-family: ‘Hannotate SC‘; font-size: large;">Some values (position, transform, and so on) that hold the animation performed at the keyframe time</span></p></p><p><p><span style="color: #010108; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) nsarray *tensionvalues, *continuityvalues, *biasvalues;</span></p></p><p><p><span style="color: #2744f9; font-family: ‘Hannotate SC‘; font-size: large;">Rotation mode</span></p></p><p><p><span style="color: #010108; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) NSString *rotationmode;</span></p></p><p><p><span style="color: #fc51cf; font-family: ‘Hannotate SC‘; font-size: large;">@end</span></p></p><p><p></p></p><p><p><span style="color: #ffcc99;">=========================================================</span></p></p><p><p></p></p><p><p><span style="color: #ff3fdc; font-family: ‘Hannotate SC‘; font-size: large;">@interface catransition:caanimation</span> <span style="color: #ff4401; font-family: ‘Hannotate SC‘; font-size: large;">//transitions Animation</span></p></p><p><p><span style="color: #3644ff; font-family: ‘Hannotate SC‘; font-size: large;">Animation transition Type</span></p></p><p><p><span style="color: #000003; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) NSString *type;</span></p></p><p><p><span style="color: #2e44ff; font-family: ‘Hannotate SC‘; font-size: large;">Animation transition Direction</span></p></p><p><p><span style="color: #000003; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) NSString *subtype;</span></p></p><p><p><span style="color: #3b4eff; font-family: ‘Hannotate SC‘; font-size: large;">Animation start and end of animation (% of overall Animation)</span></p></p><p><p><span style="color: #000003; font-family: ‘Hannotate SC‘; font-size: large;">@property float startprogress, endprogress;</span></p></p><p><p><span style="color: #2040ff; font-family: ‘Hannotate SC‘; font-size: large;">Animation filtering</span></p></p><p><p><span style="color: #000003; font-family: ‘Hannotate SC‘; font-size: large;">@property (strong) ID filter;</span></p></p><p><p><span style="color: #ff42e0; font-family: ‘Hannotate SC‘; font-size: large;">@end</span></p></p><p><p><span style="color: #ffcc99;">=========================================================</span></p></p><p><p></p></p><p><p><span style="color: #ff53ef; font-family: ‘Hannotate SC‘; font-size: large;">@interface caanimationgroup:caanimation</span> <span style="color: #ff2f1b; font-family: ‘Hannotate SC‘; font-size: large;">//animation Array (holds Many animations that can be executed simultaneously)</span></p></p><p><p><span style="color: #3553ff; font-family: ‘Hannotate SC‘; font-size: large;">Array for storing multiple animations</span></p></p><p><p><span style="color: #020000; font-family: ‘Hannotate SC‘; font-size: large;">@property (copy) Nsarray *animations;</span></p></p><p><p><span style="color: #ff53e8; font-family: ‘Hannotate SC‘; font-size: large;">@end</span></p></p><p><p><span style="color: #ff53e8; font-family: ‘Hannotate SC‘; font-size: large;"></span></p></p><p><p>IOS: Introduction to specific classes and protocols for core animations</p></p></span>

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.