Core Animation -05-Basic animation-day4

Source: Internet
Author: User

1 //2 //VIEWCONTROLLER.M3 //05 Basic Animations4 //5 //Created by Zhujiacong on 16/4/18.6 //copyright©2016 year WXHL. All rights reserved.7 //8 9 #import "ViewController.h"Ten  One @interfaceViewcontroller () A@property (Weak, nonatomic) Iboutlet Uiimageview *ImageView; -  - @end the  - @implementationViewcontroller -  -  +  --(Ibaction) Start: (ID) Sender { +      A     //1 initializing animated objects at     //KeyPath The value that needs to be changed during the animation -Cabasicanimation *basicanimation = [cabasicanimation animationwithkeypath:@"position"]; -     //2 Setting the value of the property change -Basicanimation.fromvalue = [Nsvalue valuewithcgpoint:cgpointmake ( Max,0)]; -Basicanimation.tovalue = [Nsvalue valuewithcgpoint:cgpointmake ( Max, -)]; -      in     //Animation Duration -Basicanimation.duration =3; to      +     //automatic playback of animations -     //after the animation is finished, back to the automatic reverse animation, return the animation start State the     //single play time unchanged, the total time is twice times the original *Basicanimation.autoreverses =NO; $     Panax Notoginseng     //cycle times do not change the duration of each animation -Basicanimation.repeatcount =5; the     //set the start time of the animation + //basicanimation.begintime = cacurrentmediatime () + 3; A     //fill mode for animations the     /* + Kcafillmodeforwards after the animation finishes playing, leave the layer until the end - kcafillmodebackwards the layer remains in the start position before the animation starts $ Kcafillmodeboth The set of the two above $ kcafillmoderemoved When the animation is finished, the animation effect is removed and the layer returns to its original state -      */ -Basicanimation.removedoncompletion =NO; the      -Basicanimation.fillmode =Kcafillmodeboth;Wuyi      the      -     //playback speed does not affect the waiting time Wu //basicanimation.speed = 2.0; -     //offset of Time AboutBasicanimation.timeoffset =1.5; $      -      -     //add an animation to a layer -[_imageview.layer addanimation:basicanimation Forkey:@"Basic"]; A      + } the  -- (void) Viewdidload { $ [Super Viewdidload]; the     //additional setup after loading the view, typically from a nib. the } the  the- (void) didreceivememorywarning { - [Super didreceivememorywarning]; in     //Dispose of any resources the can be recreated. the } the  About @end

Core Animation -05-Basic animation-day4

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.