iOS Development diary 16-animation animation

Source: Internet
Author: User

Today Bo Master has an animation animation demand, encountered some difficulties, here and we share, hope to progress together.

There are two types of animations in iOS development: a uiview animation, also known as an implicit animation, and a change in the value of the frame after the animation. The other is Calayer animation, also known as display animation, the model layer after the animation data will not change, the graphics back to the original position. But in actual development, Because UIView can interact with the corresponding user, so UIView animation with more.

I. Animation of UIView

1. Implementation mode: Animation block, block

Begin

Animating effects modifying property values, animation duration, etc.

Conmmit

2. Property animation, transition animation

① Property Animation Support 6 kinds: Transform structure body 6

② Transition Animation: Container view, two sub-views

Two. Calayer animation = = Core Animation = = Caanimation Animation

Caanimation Abstract class

Animation

①.caanimationgroup Combo Animation

②.catransition Transition Animation

③.capropertyanimation Property Animation (properties of Layer)

Animationwithkeypath

Cabasicanimation Basic Animations

Fromvalue Tovalue

Cakeyframeanimation Key-Frame animations

Values

The following posted UIView animation code, share with you, Calayer animation, that is, core animation you crossing can own Baidu.

1.

Animating with animation blocks

Start animating the first parameter: the name of the animation the second parameter: can be used to pass a value

[UIView beginanimations:@ "haha" context:nil];

Set the duration of the animation

[UIView setanimationduration:1.5];

[UIView Setanimationrepeatautoreverses:yes];

To set the properties of a view as required

_showview.backgroundcolor=[uicolor Graycolor];

_showview.center=cgpointmake (200, 200);

Commit animation settings, start animation

[UIView commitanimations];

2.

Animating with block

[UIView animatewithduration:1.5 animations:^{

Animation effect Settings

_showview.backgroundcolor=[uicolor Yellowcolor];

Delay

[UIView setanimationdelay:1.0];

View movement can be implemented by setting transform

 

} completion:^ (BOOL finished) {

Settings after the animation is complete

NSLog (@ "animation complete");

}];

iOS Development diary 16-animation 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.