前言
说来惭愧,iOS 8 都已经发布半年多了,而我最近才开始学习iOS 7的一些新特性,才开始去理解 iOS 7 所带来的一些界面交互的变化。
一切的源起还是来自 Facebook 在去年发布的社交、新闻聚合阅读应用Facebook Paper,当然我们在这里讨论的不是该应用是否达到了当初Facebook发布它时所定的目标,而是在于它那出色的交互设计,并从中学习到点东西。至于如何出色请见它的宣传视频,同时可以强烈推荐移步到美区 App Store 的 Paper 页面下载一个把玩下。(什么?没有美区账号!那就多看几遍的宣传视频吧!)让我们来扒扒这一应用后面的团队,该应用的UI设计师是 Mike Matas,听到这个名字不要害怕,更不要紧张,因为我跟你一样对他一无所知,抱着好奇的心态接着往下扒吧。他是这样的一个人:
15 岁高中辍学,加入了 The Omni Group。18 岁创立自己的第一个公司 Delicious Monster。2005 年 WWDC 设计作品 Delicious Library 摘得了最佳 Mac OS X 用户体验第一名和最佳 Mac OS X 产品第二名。19 岁加入苹果公司,設計了 iPhone 上的 Settings.app, Photos.app, Camera.app, Maps.app 以及电池图标,还有 Mac 上的 Photo Booth 和 Time Machine。2011年夏天创办他联合创办的 Push Pop Press 被 Facebook 收购了。
然后,我们在来看看他创办的Push Pop Press做了哪些事?他跟美国前总统、2007年诺贝尔和平奖主阿尔·戈尔合作一起开发了 Our Choice 这个号称“下一代电子书的典范”的环保类电子书App。Our Choice 有超过400张可互动的图和表,每一张在文字中的附图都能利用手指放大,有一些图表还可以用手指碰触其中的图案或横条,然后图中就会显示更详细的内容或解说。溢美之话不多说,照例放个Vimeo上的宣传视频给大家看看,还有这篇《划时代的爱地球电子书--戈尔的Our Choice》。如果你因为没有美区 App Store 账号而下载不到 Paper 的话,那恭喜你,你可以在中国区的App Store下载到 Our Choice,RMB 30。如果你还没有被我的啰嗦所打败,或者你已经对我啰嗦的话语感到深恶痛绝,那你可以出门左拐到优酷看看在 Mike Matas 在 TED 上的《下一代的电子书》演讲。
说了这么多废话之后,终于可以再回到正题了!如果你体验完了Our Choice 和 Paper 这两款 App后,你会发现他们的交互和动画几乎如出一辙。对,他们都是 Kimon Tsinteris 开发的。那么问题又来了,Kimon Tsinteris 这个又是谁呢?他是Push Pop Press 的联合创始人,曾在苹果担任高级工程师,并参与了 iPhone 和iPad 上的软件研发(iPhone的指南针及地图)。2011年,Facebook收购了他的公司,此后他便和 Mike Matas 加入了Facebook负责Facebook iOS版本的开发。Mike Matas 和 Kimon Tsinteris 他们都有一个共同的特点,那就是不满足于苹果自身动画框架的单调,他们认为:
随着触屏设备的不断发展,用户需要更加逼真的动画形式。对于用户来说,如果触摸屏上的元素可以对其触摸动作作出反馈,那么它也应该对其触摸的速率作出反馈。这也将是移动设备上动画效果接下来的发展趋势。
他们创办的Push Pop Press 就一直致力于创造一个逼真的、充满物理效应的体验,伴随着被Facebook收购后,他们这一理念也就自然而然的带到了他们所负责的产品身上,Paper 就是这样的一个产物。故事到此当然还没有结束,他们发布完Paper 之后,更进一步将其背后的动画引擎POP开源了!它目前在Github上有着10250个Star。借助于POP这个动画引擎,iOS 开发者将至少有6类动画效果可以使用了,如果再把自定义功能加进去,那么在众多开发者的努力下人机交互动画将产生无限多的可能。而这正是Pop引擎背后的工程师所愿意看到的。让我们来看看 Kimon Tsinteris 本人对这个开源库的介绍:
今天我们开源了实现Paper应用平滑动画和转场效果的动画引擎Pop。使用动态动画(dynamic animations)而不是传统的静态动画(static animations),Pop使常见的滑动(scrolling)、弹跳(bouncing)、折叠(unfolding)等效果充满了活力,也使 Paper给人一种耳目一新的感觉。
手势交互的革新迎来了新的一轮软件设计的浪潮。人们可以用手指直接操作屏幕上的元素,(而不像以前,需要一支笔),这就降低了交互的间接性(反着说,就是交互更直接),于是,人们又提出更进一步的要求:既然触屏可以得到处理,那么不同速度的滑屏操作也应该得到处理。
当我在2010年联合创办Push Pop Press公司的时候,我们的目标就是要创造一种可行的、基于物理效果(physics-everywhere)的体验。我们在寻求一种可以使人们非常愉悦、轻松的使用整个应用的解决方案,就像我们使用UIScrollView那样的顺滑。
所以从上面的这些我们可以看到,他们倡导的是随着触屏设备的不断发展,在我们的项目中应该充分的利用触屏设备的手势交互功能,App应该对用户的手势做一些相应地反应,这些反应可以包括滑动的速度、滑动的方向、重力感应、用户晃动手机的方向等等,通过这些反应来提供给用户一种愉悦、轻松的体验。
在 iOS 7 之前,我们看到的大量的App都是通过iOS系统提供的Core Animation framework所支持的传统的静态动画来实现一些简单的线性动画(linear)、淡入效果(ease-in)和淡出效果(ease-out)。

iOS系统支持提供的基础的静态动画
常规的App界面操作大体是这样的:用户点击界面上的按钮,界面通过利用上述的静态动画做出相应的反应,比如最常见的 NavigationController中界面切换的“左进右出”动画、模态视图的“下进下出”动画。这些静态动画大部分没有利用到触屏设备的手势交互功能。那些不满足现状的开发者们想做出精彩的动态动画效果大都花了九牛二虎之力,印象最深的就是看到一些应用将模态视图的“下进下出”动画硬生生的改成的了NavigationController的“左进右出”展示动画,然后就经常遇到视图控制器混乱的问题,这样的代码也不利于维护和修改。当然在iOS 7之前苹果引入了一些方法和类来解决一些问题,如UIPageViewController类、UICollectionViewController 类,以及addChildViewController:、removeFromParentViewController、 transitionFromViewController:toViewController: duration:options:animations: completion:等方法。但是,这些还是类的使用还是有着很大的局限性。尤其是addChildViewController:、 removeFromParentViewController、 transitionFromViewController:toViewController: duration:options:animations: completion: 这几个方法的重用性几乎为0。
一切的转变发生在 iOS 7,iOS 7最大的变化就是从 iOS 6 的拟物化换成扁平化。同时,加入了大量的动态效果。这里贴几张图来看看:图一是在墙纸选取界面多了一个动态墙纸选项,如果你选择了动态墙纸,在主页面当你左右晃动手机时,墙纸也会跟着动。图二是在应用中,你现在可以通过右滑手势返回到上一级界面,随着你的滑动,界面会跟着移动。图三是Messages的弹簧效果。从这些我们可以直观的看到,从iOS 7开始,苹果也开始鼓励使用动态动画。

图一:动态墙纸设置

图二:右滑返回上一级界面

图三:消息应用
既然有直观的,那肯定就会用户不直观的东西。那就是 iOS 7 的SDK(Software Development Kit,软件开发工具包)。
通过 iOS 7 的SDK(真的是罪过,现在都已经是iOS 8了,我还在研究iOS 7)我们可以看到这几个东西:
1、UIKit Dynamics (UIKit动力学)
UIKit Dynamics是UIKit中一套完整的物理引擎。它可以让我们在程序中对界面元素添加一些行为从而达到诸如重力、弹簧等现实中的动作行为。你只需在引擎中注册界面元素,并指定好物理行为,其他的事就交给物理引擎去完成了。
2、Motion Effects
Motion Effects 可以创建很酷的视差效果,就像我们上面提到的首屏动态壁纸。它基于Apple提供的重力加速器提供的数据计算分析,使我们的界面元素根据移动设备的倾斜方向做出相应的反应。
3、Custom View Controller Transitions(自定义视图控制器转场)
它是给出了一套完整的自定义View Controller之间切换效果的方案,你可以通过它简单、方便的自定义各种界面切换效果。可以轻松的就改变NavigationController中界面切换的“左进右出”动画和模态视图的“下进下出”动画。
这就是iOS 7上关于交互的重大改变,现在你可以通过有效的利用这些特性开发出独一无二的动画,玩出各种各样的特效,也让人机交互动画产生无限多的可能。
本文的目的不是介绍和讲解这些新特性,所以在此不做任何介绍。
正文
尽管 iOS 7 带来了如此伟大的特性(请允许我用“伟大”来形容),但是遗憾是,在日常常用的App中你并不容易看到这些变化,大部分应用还是采用着老式的静态动画,即使iOS 8都已经推出了大半年,即使在网络上可以轻松的找到这些新特性的教程,即使你可以看到国外大量的采用这些新特性的应用并带来了全新的交互体验。。。。。。
我觉得可能有以下几个原因:
1、国内很多常用的应用都还支持着iOS 6,甚至是iOS 5,所以导致他们没有办法很快的用上最新的特性;
2、很多公司觉得没必要在市场反响很好、有着大量用户的产品上做这些实验设计,即使他们做这些设计易如反掌;
3、设计师、产品经理、工程师对于系统的一些新特性没有及时的了解、学习跟交流,所以会出现不知道系统可以实现这些效果,即使是知道了这些特性,但是如何应用,如何设计动画又是个头疼的问题。
对于第2点显然我们没有什么能够做的,但对于第1点跟第3点我觉得我们还是可以做点力所能及的事的。
首先,对于第1点就是多鼓励身边的人将他们的手机系统升级到最新的系统,这不仅仅是为了能让开发者可以更加放心地、更加容易地开发出优秀的App, 同时,由于系统的更新往往伴随着旧系统一些bug、漏洞的修复,所以也可以让用户更加安全、放心的使用手机,毕竟手机现在在我们日常生活中得地位是如此的重要。
其次,对于第二点,就是我们今天的重点了(现在才到重点!你应该有种把我杀了的冲动吧!)。由于最近在负责一个新项目,在交互、动画的效果和实现上尝试了很多,看了很多Github上的开源库,虽然还不能简单、轻松的理解和实现那些效果,但还是觉得收获满满。古人云“独乐乐,不如众乐乐”,所以在此把看到的觉得不错的、有意思的效果列出来供大家学习参考,由于本文不是技术文章,所以只看效果、只给Github链接地址,不讨论具体实现方式等等。
1、转场动画
VCTransitionsLibrary



AnimatedTransitionGallery

ZFDragableModalTransition

GTAppMenuController

ICGTransitionAnimation

CBHazeTransitionViewController

CSStickyHeaderFlowLayout



PinterestAnimator


2、输入框
RPFloatingPlaceholders

JVFloatLabeledTextField

LTBouncyPlaceholder

3、加载动画
PWProgressView

UAProgressView
RJImageLoader

PQFCustomLoaders

4、下拉动画
UzysAnimatedGifPullToRefresh

Pull-to-Refresh.Rentals-iOS

CBStoreHouseRefreshControl


5、UITableCell
SWTableViewCell

MGSwipeTableCell





6、视图展示
MGSpotyViewController

RKCardView


HAPaperViewController

AMLoginViewController(背景模糊、加视频)


VideoCover-iOS-Demo(背景加视频)

DVOBouncer

UIView-Shake

AMWaveTransition

URBMediaFocusViewController

TwitterBirdAnimation 和 CBZSplashView 效果一样

RKNotificationHub

SOZOChromoplast

VVBlurPresentation

TinderSimpleSwipeCards

ZLSwipeableView

RGCardViewLayout

AFBlurSegue

BRFlabbyTable


VPRubberMenu

YFCardTransitions

TGLStackedViewController

CXCardView


7、UILabel
LazyFadeInView
RQShineLabel






8、UIButton
ZFRippleButton


BFPaperCheckbox

YLLongTapShare

VBFPopFlatButton

9、UINavigationBar
TLYShyNavBar

LTNavigationBar


BLKFlexibleHeightBar


BMYScrollableNavigationBar

最后
如果你看到了这里,那么我真的太感谢你了!谢谢!
附录:
1、Facebook开放动画引擎Pop,你也可以打造和Paper一样酷的应用了
2、Introducing Pop, the animation engine behind Paper
3、Facebook Paper背后的动画引擎Pop介绍(译文)
网友评论