Cakeyframeanimation-ibaby of IOS Core animations

Source: Internet
Author: User

-Cakeyframeanimation of IOS core animations

-Brief introduction

is a subclass of Capropertyanimation, the difference with cabasicanimation is that cabasicanimation can only change from one numeric value (Fromvalue) to another (Tovalue), And Cakeyframeanimation will use a nsarray to save these values

-Attribute parsing:

-Values: This is the Nsarray object above. The elements inside are called "keyframes" (keyframe). The animated object displays each keyframe in the values array in the specified time (duration), in turn

-Path: You can set a cgpathref\cgmutablepathref so that the layer moves along the path. Path only works on Calayer's anchorpoint and position. If you set the path, the values will be ignored

-Keytimes: You can specify a corresponding point in time for the corresponding keyframe, with a value range of 0 to 1.0,keytimes each time value corresponds to each frame in values. When the keytimes is not set, the time of each keyframe is equally divided.

-Description: Cabasicanimation can be seen as a maximum of only 2 keyframes cakeyframeanimation

-Mode of values:

-Cakeyframeanimation *animation = [cakeyframeanimation animation];

Animation.keypath = @ "position";

Nsvalue *value1=[nsvalue valuewithcgpoint:cgpointmake (100, 100)];

Nsvalue *value2=[nsvalue Valuewithcgpoint:cgpointmake (200, 100)];

Nsvalue *value3=[nsvalue Valuewithcgpoint:cgpointmake (200, 200)];

Nsvalue *value4=[nsvalue valuewithcgpoint:cgpointmake (100, 200)];

Nsvalue *value5=[nsvalue valuewithcgpoint:cgpointmake (100, 100)];

[Email protected] [Value1,value2,value3,value4,value5]; Animation.repeatcount=maxfloat;

Animation.removedoncompletion = NO;

Animation.fillmode = Kcafillmodeforwards;

Animation.duration = 4.0f;

Animation.timingfunction=[camediatimingfunction Functionwithname:kcamediatimingfunctioneaseineaseout];

animation.delegate=self;

[Self.myView.layer addanimation:animation Forkey:nil];

-Path Mode:

-Cakeyframeanimation *animation = [cakeyframeanimation animation];

Animation.keypath = @ "position";

Cgmutablepathref path=cgpathcreatemutable ();

Cgpathaddellipseinrect (Path, NULL, CGRectMake (150, 100, 100, 100));

Animation.path=path;

Cgpathrelease (path);

Animation.repeatcount=maxfloat;

Animation.removedoncompletion = NO;

Animation.fillmode = Kcafillmodeforwards;

Animation.duration = 4.0f;

Animation.timingfunction=[camediatimingfunction Functionwithname:kcamediatimingfunctioneaseineaseout];

animation.delegate=self;

[Self.myView.layer addanimation:animation Forkey:nil];

-KeyPath can use the key

-#define Angle2radian (angle) ((angle)/180.0*M_PI)

-Transform.rotation.x rotation around the x-axis parameter: Angle Angle2radian (4)

TRANSFORM.ROTATION.Y rollover parameters around the y-axis: Ibid.

Transform.rotation.z Flip parameter around Z axis: ibid.

Transform.rotation By default around z-axis

transform.scale.x x-Direction Scaling parameter: Scale 1.5

Transform.scale.y y-Direction scaling parameter: Ibid.

Transform.scale.z Z-Direction scaling parameter: Ibid.

Transform.scale all directional scaling parameters: Ibid.

transform.translation.x x-Direction movement parameter: coordinates on x-axis 100

TRANSFORM.TRANSLATION.Y x-direction move parameter: coordinates on y-axis

Transform.translation.z x-direction move parameter: coordinates on z-axis

Transform.translation Move parameter: Move to the point (100,100)

Opacity transparency Parameters: transparency 0.5

BackgroundColor background Color parameter: color (ID) [[uicolor Redcolor] Cgcolor]

Cornerradius Fillet parameter: Fillet radius 5

BorderWidth Border Width parameter: border Width 5

Bounds size parameter: CGRect

Contents Content parameter: Cgimage

Contentsrect Visual Content parameter: CGRect value is a decimal between 0~1

Hidden is hidden

Position

Shadowcolor

Shadowoffset

Shadowopacity

Shadowradius

*

Cakeyframeanimation-ibaby of IOS 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.