The touch of the Core animation (Iv.)

Source: Internet
Author: User

First, transition animation acceptance

A subclass of caanimation for transition effects that can be animated to move or remove a screen from a layer. For example, like Uinavigationcontroller is the use of the transition animation to launch and enter the page.

Include attributes:

Type: Transition types of animations (how to perform transition animations)

Subtype: Transition Direction

Startprogress: Starting point (percentage of overall animation)

Endprogress: Endpoint (percentage of overall animation)


Second, code example

{

Create a transition animation instance

Catransition *ctanima = [catransition animation];

Set Transition type

Ctanima.type = @ "Cude";

Set the transition direction

Ctanima.subtype = Kcatransitionfromleft; Perform transition animations from the left

Animation Execution Time

Ctanima.duration = 1.0f;

Of course, you can also set the start point

ctanima.startprogress = 0.5;

ctanima.endprogress = 0.5;


Last added to the specified view

[Layer Addanimation:ctanima Forkey:nil];


}


Three, the group animation simple Introduction

Also a subclass of Caanimation, you can save an animated set of objects, and when you add caanimationgroup to a layer, all the animations in the group run concurrently.

Include attributes:

Animatitons: An array to save the animation

By default, a set of animated objects is run by a colleague, or you can set the start time by modifying the begintime.


Iv. code Examples

{

Create a few different animations first

Cabasicanimation *b1 = [cabasicanimation animation];

B1.keypath = @ "position"; Translation

B1.byvalue = [Nsvalue valuewithcgpoint:cgpointmake (+)];


Cabasicanimation *b2 = [cabasicanimation animation];

B2.keypath = @ "bounds"; Scaling

B2.tovalue =[Nsvalue valuewithcgrect:cgrectmake (0, 0, $)];


Cabasicanimation *b2 = [cabasicanimation animation];

B2.keypath = @ "transform"; Rotating

B2.tovalue =[nsvalue valuewithcatransform3d:catransform3dmakerotation (m_pi_4, 0, 0, 1)];


And put these animations into the array.

Caanimationgroup *canimag = [caanimationgroup animation];

canimag.animations = @[b1,b2,b3];

canimag.duration = 2.0f;

canimag.removeoncompletion = NO;

canimag.fillmode = kcafillmodeforwards;

Last added to the specified view

[View.layer addanimation:canimag Forkey:nil];

}





This article is from the "11562149" blog, please be sure to keep this source http://11572149.blog.51cto.com/11562149/1784747

The touch of the Core animation (Iv.)

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.