Motion Design for IOS (39)

Source: Internet
Author: User

Introducing Pop from Facebook

In April 2014, Facebook's engineer, Kimon Tsinteris, released a spring-animated framework Pop,facebook built to support their app paper. The framework's origins were in fact earlier than Facebook,kimon's build-up of most of the e-book companies he was bought by Facebook in 2011 to push Pop Press. You may remember the push Pop Press, which won the Apple Design Award as an ebook for the ipad, built for Ai Gore, known as our Choice.

Click to watch Ai Gore's ' Our Choice ' – an IPad app video

"Our Choice" was really groundbreaking in 2011. It was one of the first iOS apps to have a complete gesture-based interface to manipulate the content. Each visual element on the screen is animated by spring and has a good elasticity and response, which is never seen.

Fast forward to the early 2014 to introduce some of Facebook's paper. The paper also contains gesture-based controls and spring animations, and can be found, all based on the work of Al Gore's ebook three years ago. Fortunately for our developers, Facebook believes that their animated frame POPs are worth exposing to the community, so that others can build cool, spring-based animation apps.

Pop VS Core Animation

When we discussed the core animation in front of this book and how it worked on a basic level, I got to know the difference between the model layer and the presentation layer. The model layer represents an attribute that is known to be accurate calayer pre-added to the animation. If you add an animation to a layer and then ask the model layer what its properties are when the animation is halfway through, the answer is not to reflect the current content of any animation. If you want to know the value of a real-time, moving layer in the animation, you have to look at the presentation layer. Once the animation is complete, the presentation layer disappears, so if you don't want your layer to go back to the beginning, you need to set the properties of the model layer to match the final state of the animation.

This is the work of core animation. This is an essential implementation choice that Apple has made many years ago to build an animated framework for an iphone. And since Jnwspringanimation has simply developed a core animation object for us CAKeyframeAnimation , we still need to set the final value of the animated model layer to hold when it's done.

Pop is completely different!

Pop does not use the core animation to perform any of the animation features it provides. The difference is that it sets a special time object to execute once every 1/60 seconds. The code that executes 60 times per second updates any attributes you want directly based on the next position you define in the spring action. No special, extra layer is added to your element, pop UIView CALayer changes attributes directly or, or, interestingly, changes on any object type you want. This means that at any point in the animation, you can directly touch the current value of the changed property without jumping to any of the presentation layers. And better yet, you don't have to set the final value individually so that the animation stays there, because the animation always works on the actual real value.

The time object this pop uses to support the entire frame is CADisplayLink that it can be seen as NSTimer a more advanced version of Nstimer, a Mac game developer who is used to running code on a frame in their Mac and iOS games all year round. You NSTimer can call any code you want to call at any time you want, repeatedly or only once. If you want to call code once every 5 seconds, you can use it NSTimer . Or if you want to invoke the code 60 times per second, you can NSTimer do it, but when you call the code so quickly (such as moving a little bit of pixels at a time, animating an interface element one step at a time), the object loses the exact sync refresh rate, and you may lose some frames, Which led to some strange short jumps.

This is CADisplayLink where the display is. CADisplayLinkis designed to avoid this problem because it is not set at the interval, and the rate at which it calls your method over and over again depends entirely on how often the screen is refreshed. It launches your code with the refresh of the screen, so you have the best chance to update your interface 60 times per second (smoothing the time to perceive the action). This is the method that pop uses to push the animation one pixel at a time, 1/60 seconds.

Finished viewing the integration set: Https://github.com/Cloudox/Motion-Design-for-iOS
All rights reserved: Http://blog.csdn.net/cloudox_

Motion Design for IOS (39)

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.