[IPhone application development] iPhone application development day 11: three types of commonly used animations

Source: Internet
Author: User

 

In iPhone development, we often need to perform animation switching between different pages, which looks better. There are three basic animations:

1. uiview

Uiview provides five official animation effects for you:

 
Uiviewanimationtransitionnone does not use the animation rotate from left to right to flip pages. The opposite is uiviewanimationtransitioncurlup, and uiviewanimationtransitioncurldown.

 

Example:

[Uiview beginanimations: @ "animationid" context: Nil]; // start an animation block. The first parameter is the animation block identifier [uiview setanimationduration: 0.5f]; // set the animation duration [uiview setanimationcurve: uiviewanimationcurveeaseinout]; // set the curve of the animation attribute change in the animation block. This method must be used in the beginanimations method and commitanimations method, the default value is uiviewanimationcurveeaseinout. For details, see uiviewanimationcurve [uiview setanimationrepeatautoreverses: No]; // sets whether to automatically reverse the current animation effect. [uiview setanimationtransition: uiviewanimationtransitionflipfromleft forview: Self. view cache: Yes]; // sets the animated Effect of transition. The first parameter can be set to [self. view exchangesubviewatindex: 1 withsubviewatindex: 0]; // page flip [uiview commitanimations]; // submit an animation

 

In this way, we can make the uiview page jump between pages through animation.

2. catransiton

Catransiton provides four types of animation effects:

Nsstring * const kcatransitionfade; // gradually disappears

Nsstring * const kcatransitionmovein; // overwrite

Nsstring * const kcatransitionpush; // available

Nsstring * const kcatransitionreveal; // opposite to movein

 

Example:

Catransition * animation = [catransition animation]; // initialize the animation. duration = 0.5f; // the interval of the animation. timingfunction = uiviewanimationcurveeaseinout; animation. type = kcatransitionpush; // set the animation effects of the above four types. subtype = kcatransitionfromtop; // set the animation direction. There are four options: kcatransitionfromright, kcatransitionfromleft, kcatransitionfromtop, and kcatransitionfrombottom [self. view. layer addanimation: animation forkey: @ "animationid"];

 


 

3. Private Animation

The private animation is based on the uiview and sets the animation. type. You can provide the following options:

Cube: ImageCubeFlipped like a body

Suckeffect: scaled down, just like the animation used to delete a photo

Oglflip: up/down rotation. When the subtype is fromleft or fromright, it is the same as uiviewanimationtransitionflipfromleft and uiviewanimationtransitionflipfromright.

Rippleeffect: Water Wave Effect

Pagecurl: Same as uiviewanimationtransitioncurlup

Pageuncurl: Same as uiviewanimationtransitioncurldown

Camerairishollowopen: First Half of camerairis.

Camerairishollowclose: Second Half of camerairis

Append an animationSource codeFor your reference, we will introduce the animation effect here today. Thank you.

Attachment address: http://files.cnblogs.com/huangdongcheng/transition_ViewTransitions.zip

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.