0125--Animation 2

Source: Internet
Author: User

//Explicit hidden
Cabasicanimation *capacityanimation = [cabasicanimation animationwithkeypath:@ "opacity"];
Capacityanimation.fromvalue = @1;
Capacityanimation.tovalue = @0;

//Zoom in and zoom out
Cabasicanimation *scaleaniamation = [cabasicanimation animationwithkeypath:@ "Transform.scale"];
Scaleaniamation.fromvalue = @0.5;
Scaleaniamation.tovalue = @1.5;

Cabasicanimation *moveanimation = [cabasicanimation animationwithkeypath:@ "position"];
Moveanimation.tovalue = [Nsvalue valuewithcgpoint:cgpointmake (200, 200)];

Cabasicanimation *rotateaniamation = [cabasicanimation animationwithkeypath:@ "transform"];
Rotateaniamation.fromvalue = [Nsvalue valuewithcatransform3d:catransform3didentity];
Rotateaniamation.tovalue = [Nsvalue valuewithcatransform3d:catransform3drotate (_layer.transform, M_PI, 0.3, 0.5, 1)];

Add animations
[Catransaction setanimationduration:1.0];//Animation speed
[_layer addanimation:capacityanimation Forkey:nil];
[_layer addanimation:scaleaniamation Forkey:nil];
[_layer addanimation:moveanimation Forkey:nil];
[_layer addanimation:rotateaniamation Forkey:nil];

//Group animation
Caanimationgroup *group = [Caanimationgroup animation];
Group.duration = 1;
Group.removedoncompletion = NO;
Group.fillmode = Kcafillmodeforwards;
Group.timingfunction = [Camediatimingfunction Functionwithname:kcamediatimingfunctioneasein];

Group.animations = @[capacityanimation,scaleaniamation,moveanimation,rotateaniamation];

[_layer Addanimation:group Forkey:nil];

There are more details and advanced applications for core animation: https://zsisme.gitbooks.io/ios-/content/chapter1/the-layer-tree.html

0125--Animation 2

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.