IOS 8 Spring Animation

Source: Internet
Author: User

About Spring Animation

Spring Animation is essentially a special animated curve that has been widely used in system animations since IOS 7. The self-contained animations shown in are actually using Spring Animation:

In fact, almost all system animations from IOS 7 use Spring Animation, including App folder open/close effects, keyboard pop-up effects, switch effects for uiswitch controls, Push animations between different View controllers, Modal Animations that appear and disappear, the appearance and disappearance of Siri, and so on. A comparison of the motion curves for Spring Animation and normal animations:

To be more intuitive, I've made a demo project that lists the animated effects of Spring Animation, Ease-out Animation and Linear Animation, respectively, from left to right:

Can be seen, and the system comes with the ease-out effect compared to the Spring Animation earlier speed increased faster, in the animation time certain premise, give people feel faster and cleaner.

Api

Starting with IOS 8, Apple exposes the Spring Animation API, and developers can create such animations with simple code:

+ (void)animatewithduration:(nstimeinterval) duration                      delay:(nstimeinterval) delay     usingspringwithdampinginitialspringvelocityoptionsanimations:(void (^) (void))  Completion:(void (^) (finished))completion         

The method is UIView the class method.

The Spring Animation API has two more parameters than normal animations, respectively usingSpringWithDamping initialSpringVelocity .

Dumping ratio

usingSpringWithDampingThe range is 0.0f to 1.0f , the smaller the value of the "Spring" vibration effect is more obvious. Demonstrated in the initialSpringVelocity case 0.0f of the circumstances, usingSpringWithDamping respectively taken 0.2f , 0.5f and 1.0f the case.

Initial velocity

initialSpringVelocityIndicates the initial speed, the higher the number, the faster the movement begins. Illustrates the usingSpringWithDamping 1.0f case when, initialSpringVelocity respectively, take 5.0f , 15.0f and 25.0f . It is worth noting that the initial speed value is higher and the time is short, there will also be rebound situation.

Use

Spring Animation is an ideal alternative to linear or ease-out animations. Because the IOS itself is heavily used by Spring Animation, users are accustomed to the animated effect, so using it can make the App feel more natural, in Apple's words is "instantly familiar". In addition, Spring Animation is not only available for locations, it applies to all properties that can be animated.

IOS 8 Spring 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.