In objective-C, there are two animation implementation methods)

Source: Internet
Author: User

Method 1:

 

View plain
  1. [Uiview beginanimations: @ "curl" context: Nil]; // starts the animation.
  2. [Uiview setanimationduration: 1.25]; // animation duration
  3. [Uiview setanimationcurve: uiviewanimationcurveeaseinout]; // animation speed
  4. [Uiview setanimationtransition: uiviewanimationtransitioncurlup // type
  5. Forview: Self. View
  6. Cache: Yes];
  7. [Uiview commitanimations];

 

 

 

Method 2:

 

View plain
  1. Catransition * animation = [catransition animation];
  2. [Animation setduration: 1.25f];
  3. [Animation settimingfunction: [camediatimingfunction functionwithname: kcamediatimingfunctioneasein];
  4. [Animation settype: kcatransitionreveal];
  5. [Animation setsubtype: kcatransitionfrombottom];
  6. [Self. View. layer addanimation: animation forkey: @ "reveal"];

 

 

 

 

Settype: four types can be returned:

1. kcatransitionfade fade out

2. kcatransitionmovein overwrites the source Image

3. kcatransitionpush

4. The bottom of kcatransitionreveal is shown

 

Setsubtype: there can also be four types:

1. kcatransitionfromright;

2. kcatransitionfromleft (default)

3. kcatransitionfromtop;

4. kcatransitionfrombottom

 

 

 

There is also a way to set the animation type, without setsubtype, only settyp

 

View plain
  1. [Animation settype: @ "suckeffect"];

 

 

 

Note:

 

After wasting a lot of time and patience, it is tested that only the following types are available now:

Suckeffect (triangle)

Rippleeffect)

Pagecurl)

Pageuncurl (Flip-down)

Oglflip (up/down flip)

Camerairis/camerairishollowopen/camerairishollowclose

 

 

 

The following is a blacklist:

Speweffect: the new layout is released in the middle of the screen to overwrite the old layout.

-Genieeffect: the old version is sucked out at the lower left or lower right of the screen to display the new layout (Aladdin lamp God?) below ?).

-Ungenieeffect: the new layout is released in the lower left or lower right corner of the screen to overwrite the old layout.

-Twist: the layout is transferred horizontally like a tornado.

-Tubey: the layout is vertically attached with an elastic transfer.

-Swirl: the old version rotates at 360 degrees and fades out to display a new layout.

-Charminultra: the old version fades out and displays the new layout.

-Zoomyin: the new layout goes from small to front, and the old version disappears from front to front.

-Zoomyout: zoomyout appears outside the screen of the new layout, and the earlier version disappears.

-Oglapplicationsuspend: the effect of pressing the "home" button.

Also, mapcurl and mapuncurl

The constant variables of the five predefined time functions are

Kcamediatimingfunctionlinear,

Kcamediatimingfunctioneasein,

Kcamediatimingfunctioneaseout,

Kcamediatimingfunctioneaseineaseout,

Kcamediatimingfunctiondefault.

The curve of the preceding four timing functions is displayed. The horizontal coordinates represent the time and the vertical coordinates represent the change volume. This need to be clarified (not the XY in the plane coordinate system ).

The function image of the custom timing function is a cubic betel curve (cubic bezercurve). The advantage of the betel curve is that it is smooth, and the changes appear smooth here. A Cubic besell curve can be determined by the starting point and the two control points.

The above kcamediatimingfunctiondefault function curve is actually through [(0.0, 0.0), (0.25, 0.1), (0.25, 0.1), (1.0, 1.0)] the three besell curves determined by these four points. The beginning and end are the start point and the end point, and the two points in the middle are the control points.


P0 is the starting point, P3 is the ending point, and P1 and P2 are two control points.

If the time-varying curve is neither a straight line nor a beiser curve, but a custom curve, or the trajectory of a layer movement is not a straight line but a curve, these are basically impossible for animation, therefore, the following content is introduced, namely, the key frame animation.

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.