Types and implementation methods of iOS animation effects, and ios animation types

Source: Internet
Author: User

Types and implementation methods of iOS animation effects, and ios animation types

There are two main ways to achieve beautiful iOS animation effects,

One is at the UIView level,

One is to use CATransition for lower-level control,

 

The first is UIView. The UIView method may also be encapsulated by CATransition on the lower layer. It can only be used for some simple and common effects. Here, we will write a common sample code, for your reference.

 

[UIView beginAnimations: @ "Curl" context: nil]; // The animation starts [UIView setAnimationDuration: 0.75]; [UIView setAnimationDelegate: self]; [UIView setAnimationTransition: Previous forView: myview cache: YES]; [myview removeFromSuperview]; [UIView commitAnimations];

 

The second method is relatively complicated, but if you want to control it better, use this method,

The following is an example of the basic usage:

 

CATransition * animation = [CATransition animation]; [animation setDuration: 1.25f]; [animation setTimingFunction: [animation encoding: animation]; [animation setType: animation]; [animation setSubtype: kCATransitionFromBottom]; [self. view. layer addAnimation: animation forKey: @ "Reveal"];

The setType and setSubtype combinations are used here, which is relatively safe, because their parameters are defined in the official API. Their parameter descriptions can be referred to below:

 

[Animation setType: @ "suckEffect"];

SuckEffect here is the name of the effect. The following effects can be used:

PageCurl flip one page up pageUnCurl flip one page down rippleEffect drip effect suckEffect shrink effect, such as a piece of cloth is extracted from the cube effect oglFlip flip up and down effect

Finally, a common code is provided for your reference.

// Curl the image up or down CATransition * animation = [CATransition animation]; [animation setDuration: 0.35]; [animation setTimingFunction: UIViewAnimationCurveEaseInOut]; if (! Curled) {// animation. type = @ "mapCurl"; animation. type = @ "pageCurl"; animation. fillMode = kCAFillModeForwards; animation. endProgress = 0.99;} else {// animation. type = @ "mapUnCurl"; animation. type = @ "pageUnCurl"; animation. fillMode = kCAFillModeBackwards; animation. startProgress = 0.01;} [animation setRemovedOnCompletion: NO]; [view exchangeSubviewAtIndex: 0 withSubviewAtIndex: 1]; [view addAnimat Ion: animation forKey "pageCurlAnimation"]; // Disable user interaction where necessary if (! Curled) {} else {} curled =! Curled;
How can I use ios to implement a GUI similar to Baidu audio and video? It is the first time that text fades in and out of animation.

Are you engaged in ios development? Or something else? The transparency of the label can be modified when the text fades in and out, and then the animation can be done. I don't know. What do I mean?

In IOS development, page flip animation is implemented between pages. It is supported from bottom up to four directions. How can this problem be solved? I know there is a built-in animation that can be uploaded from top to bottom.

Please move to the code4app
Find the View Transition label of the iOS code
Have the answer you want

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.