Core Animation base Animation (cabasicanimation) Keyframe animation

Source: Internet
Author: User
Tags set time

1. Core animations are grouped into several categories in iOS:

Base Animation (cabasicanimation)

Keyframe Animation (cakeyframeanimation)

Animation Group (Caanimationgroup)

Transition Animation (catransition)

2.CAAnimation: Core animation of the basic class, can not be used directly, responsible for animation running time, speed control, itself to achieve the Camediatiming protocol

3.CAPropertyAnimation: Property animation is also a base class (animated by property, note is animated property), and cannot be used directly.

Cabasicanimation: Basic animation, animation parameter control through property modification, only initial state and end state.

Cakeyframeanimation: Keyframe animation is also controlled by animating parameters with attributes, but unlike the underlying animation, it can have multiple state controls.

Caanimationgroup: Animation group, animation group is a combination of pattern design, you can use animation group to do all the animation behavior of the unified control, all the animation effect in the group can be executed concurrently.

Catransition: Transition animation, mainly through the filter animation effect settings.

4. Basic animation, Keyframe animation are property animation, that is, by modifying the property values to animate, developers only need to set the initial value and the end value, the middle of the process animation (also known as "motion Tween") by the system automatically calculated. Unlike the underlying animations, Keyframe animations can set multiple property values, and the tweened animation in the middle of each of the two properties is automatically completed by the system, so the underlying animation can be seen as a keyframe animation with two keyframes from this point of view.

5.CAAnimation Create a base animation, you need to specify a start value and an end value through the Fromvalue and Tovalue properties, and it starts moving when the underlying animation is added to the layer.

Autoreverses: When this property is set to Yes, the starting value is returned in an animated manner after it has reached its destination.

Duration: The time it takes to set the start value to the end value, which is affected by the speed attribute.

The default value for Speed is 1.0. This means that the animation plays by default. If you change this value to 2.0, the animation will play at twice times the speed. The effect is to halve the duration of the time. If you specify a duration of 6 seconds and a speed of 2.0, the animation will play for 3 seconds---Half the duration of the time

Setting the speed to 0 will end the animation

6.repeatCount default is 0, meaning that the animation will only play once this should not be used with the Repeatdration property. (negative numbers are not infinite loops)

RepeatDuration This property specifies how long the animation should be repeated. The animation repeats until the set time elapses. It should not be used with RepeatCount

7. Timingfunction speed control function to control the rhythm of animation operation

Timingfunction Property Value:

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.

The 8.removedOnCompletion default is yes, which is removed from the layer after the animation has finished executing, and the drawing reverts to the state before the animation was executed. If you want the layer to remain displayed after the animation has been executed, set to No, (* * * * but also set Fillmode to kcafillmodeforwards***)

Fillmode sets the behavior of the current object during an inactive time period, such as before the animation starts or after the animation ends

Fillmode property value (mentioned above to want to fillmode valid, need to set removedoncompletion = NO)

Kcafillmoderemoved This is the default value, that is, when the animation starts and after the end of the animation, the animation has no effect on the layer, the end of the animation, the layer will revert to the previous state

Kcafillmodeforwards when the animation is finished, the layer will remain the last state of the animation

Kcafillmodebackwards before the animation begins, just add the animation to a layer,layer and immediately enter the initial state of the animation and wait for the animation to begin.

Kcafillmodeboth This is actually the synthesis of the above two. The layer is in the initial state of the animation before the animation is added, and the layer retains the last state of the animation after the animation is finished.

9.CAPropertyAnimation

You can change the properties of an animation by changing the Animationwithkeypath:

Properties of the animation

Transform.scale = Proportional Conversion

Transform.scale.x

Transform.scale.y

Transform.rotation.z

opacity = Transparency

Zposition

BackgroundColor background Color

Cornerradius rounded Corners

BorderWidth

Bounds

Contents

Contentsrect

Cornerradius

Frame

Hidden

Mask

Maskstobounds

Opacity

Position

Shadowcolor

Shadowoffset

Shadowopacity

Shadowradius

----------------------------

Core Animation base Animation (cabasicanimation) Keyframe animation

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.