iOS learning--core animations

Source: Internet
Author: User

Introduction of 1.CoreAnimation

Core Animation, the Chinese translation is a central animation, it is a very powerful set of animation processing API, using it can make very beautiful animation effect, and often do more with less. In other words, very powerful functionality can be achieved with a small amount of code. Core animation can be used on Mac OS X and iOS platforms. The animation execution of Core animation is performed in the background and does not block the main thread.

It is important to note that the Core animation is directly acting on the Calayer, not UIView

Detailed Address: http://www.cnblogs.com/mjios/archive/2013/04/15/3021039.html

Steps to use 2.CoreaAnimation

1> before XCODE5, you need to add the Quartzcore.framework framework and introduce the main header file <QuartzCore/QuartzCore.h>

2> Initializes a Caanimation object and sets some animation-related properties

3> by calling Calayer's Addanimation:forkey: method to add the Caanimation object to the Calayer so that it can begin to perform the animation

4> by calling Calayer's Removeanimationforkey: method to stop the animation in Calayer

The essence of performing animations is to change the properties of layer layers,coreanimation directly on Calayer . Concrete steps for using core animations

1> Creating Calayer

2>touchbegin, click on the screen, do the animation

How does 3> perform animation? The essence of performing animations is to change the properties of a layer

4> tell the animation to do what kind of animation? Set animation properties (position)

5> tell the animation properties how to change? Set Animation property value Change Tovalue fromvalue

6>duration: Animation duration

Does the animation bounce? Cancel Bounce

(1) Do not remove after performing the animation

(2) Set the animation fill mode, keep the latest position

Some of the commonly used animation properties:

1>duration: Animation Properties

2>repeatcount: Number of repetitions
3>timingfunction: Controlling the execution rhythm of animations

    • Kcamediatimingfunctionlinear (linear): constant speed, gives you a relatively static feeling
    • Kcamediatimingfunctioneasein (Progressive): Animation slowly enters, then accelerates to leave
    • Kcamediatimingfunctioneaseout (Fade Out): Animation enters at full speed, then slows down to the destination
    • Kcamediatimingfunctioneaseineaseout (gradual fade Out): The animation slowly enters, the middle accelerates, then slows down to reach the destination. This is the default animation behavior.

4> Animation agent: Monitoring the animation process


Introduction to 3.CALayer

iOS learning--core animations

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.