Introduction to core animation of IOS () UI and ios Animation

Source: Internet
Author: User

Introduction to core animation of IOS () UI and ios Animation

CAT/CAT sharing, must be excellent

For Original Articles, please reprint them. Reprinted Please note: Yan Nai-yu's blog
Http://blog.csdn.net/u013357243? Viewmode = contents

Core animation (Introduction)

Core Animation, a Core Animation for Chinese translation, is a group of very powerful Animation processing APIs that can be used to make brilliant Animation effects, and often get twice the result with half the effort. That is to say, a small amount of code can be used to implement very powerful functions.
Core Animation can be used on Mac OS X and iOS platforms.

The Animation execution process of Core Animation is performed in the background without blocking the main thread.
Note that,Core Animation works directly on CALayer, not UIView.

How to use Core Animation

1. to use it, you must first add the QuartzCore. framework and introduce the main header file.

CAAnimation inheritance Structure

CAAnimation is the parent class of all animation classes, but it cannot be used directly. Its subclass should be used.

CAAnimation common attributes

Duration: animation duration

RepeatCount: Number of animation repetitions

TimingFunction: controls the animation running pace

Note:
(1) There are only four animation classes available: CABasicAnimation, CAKeyframeAnimation, CATransition, and CAAnimationGroup.

(2) CAMediaTiming is a protocol ).

CAPropertyAnimation is a subclass of CAAnimation, but it cannot be used directly. To create an animation object, use its two subclasses: CABasicAnimation and CAKeyframeAnimation.

It has an NSString type keyPath attribute. You can specify a CALayer attribute named keyPath and modify the value of this attribute of CALayer to achieve the corresponding animation effect. For example, if @ "position" is specified as keyPath, the value of the position attribute of CALayer is modified to achieve the animation effect of translation.

Supplement

The parent class of all animation objects, which controls the animation duration and speed. It is an abstract class and cannot be used directly. It should be used as a subclass.

Attribute parsing: (red indicates the attribute from the CAMediaTiming Protocol)

Duration: animation duration

RepeatCount: Number of animation repetitions

RepeatDuration: animation repetition time

RemovedOnCompletion: The default value is YES, indicating that the animation will be removed from the layer after execution, and the image will be restored to the state before execution. If you want the layer to remain in the animation state after execution, set it to NO, but set fillMode to kCAFillModeForwards.

FillMode: determines the behavior of the current object in a non-active period. For example, before the animation starts, after the animation ends

BeginTime: it can be used to set the animation execution delay time. If you want to delay for 5 seconds, set CACurrentMediaTime () + 5, and CACurrentMediaTime () as the current time of the layer.

TimingFunction: A speed control function that controls the animation running pace.

Delegate: animation proxy

Related Article

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.