7. 切换屏幕 Screen Transitions - Origami Studio教程


下载教程文件** ·····密码: ahgt**

选择对应名称的文件夹下载,内包含一个(开始)和一个(已完成)文件;(开始)文件用来和教程同步操作,(已完成)是最终结果。


Create screen flows. 创建屏幕切换流程

Creating screen flows in Origami is easier than you might think, and still allows for some more complex interactions within screens.

在 Origami 中创建屏幕流程比你想的要容易得多,并且仍然允许在屏幕内进行复杂的交互。

We are going to recreate the Instagram Boomerang interface, with scrolling behavior in one of the screens. It even has some of the more advanced iOS behavior such as offset as the screen moves.

本篇教程将搭建 Instagram Boomerang 的界面,其中一个页面还有滚动。甚至有一些高级的 iOS 行为,如屏幕移动时的偏移。

Screen 屏幕

The starting tutorial files have three Screen layers set up already. If you need to add more, click on the New Layer button Shift Cmd N and type to find Screen.

教程文件中已经创建三个屏幕层了。如果需要添加更多屏,按 Shift Cmd N 打开新图层下拉框,在控件类图层中找到 Screen 点击添加。

Screen start state 屏幕的启动状态

Screens are presented by default, so right now, they are stacked on top of each other. Click Screen Share and change the Start State to Dismissed.

屏幕默认情况下是显示,所有的屏幕都重叠在一起。选中 Screen Share 图层,将属性 Start State 的值改为 Dismissed。

Restart the prototype by clicking on the Restart Prototype button in the Viewer toolbar, and then repeat the process for Screen Boomerangs; click on the Screen Boomerangs layer, change the Start State to Dismissed, and then click the Restart Prototype button.

点击查看器工具栏中的 “重启” 按钮重启原型。
然后将 Screen Boomerangs 图层的属性 Start State 的值也改为 Dismissed。重启原型。

You should now see Screen Main by default, with all other screens hidden. 现在应该能看到默认屏 Screen Main ,其他屏被隐藏了。

The last screen is Screen Main. It is a regular Group layer since it is not going anywhere.

最后一个屏是 Screen Main。一个常规的组层,因为它不会去任何地方。

Linking screens 连接屏幕

The first screen transition is from Screen Main to Screen Boomerangs. We need a Hit Area to take us there.

第一个跳转是从 Screen Main 跳转到 Screen Boomerangs。我们需要点击一个点击区域来启动跳转。

A Hit Area named Open Boomerangs exists within Screen Main, covering the thumbnail in the Viewer. Make it interactive by hovering over Open Boomerangs, clicking on Touch, then clicking on Tap.

Screen Main 组内有一个名为 Open Boomerangs 的热区,覆盖在查看器中的缩略图上。给这个热区加一个 Tap 交互模块。

Connect the Tap output of the Open Boomerangs Hit Area to the Present property of Screen Boomerangs. Tapping the thumbnail in Screen Main should now open Screen Boomerangs.

将交互模块的 Tap 输出口连接到 Screen Boomerangs 图层的状态属性 Present 上。

We don't need to add any Switch, Pop Animation, or Transition patches, because Screen handles all of this for us.

不用添加 Switch、Pop animation 和 Transition 模块,因为 Screen 包含了这仨呢。

Linking back 返回的连接

The next thing we need is a way to get back to our Screen Main. A Hit Area named Dismiss Boomerangs has already been created for this purpse, inside of Screen Boomerangs.

下一步还得瞅瞅咋回到 Screen Main 页面。Screen Boomerangs 内部已经创建了一个命名为 Dismiss Boomerangs 的热区。

Like before, make that interactive by hovering over Dismiss Boomerangs, clicking on Touch, and then clicking Tap.

跟上一步一样,给这个热区加一个 Tap 交互。

Our new Interaction patch is going to affect Screen Boomerangs. Click and drag on the Tap of the new Interaction patch and connect it to Dismiss Screen Boomerangs.

这个新的 Interaction 模块将会影响 Screen Boomerangs 图层。点击并拖动新 Interaction 模块的 Tap 输出口连接到 Screen Boomerangs 图层的状态属性 Dismiss。

Now tapping on the cross in our prototype should take us back to Screen Main, and clicking on the thumbnail should take us to Screen Boomerangs.

现在点击关闭按钮应该会回到 Screen Main,点击缩略图再次打开 Screen Boomerangs。

Changing transitions types 改变过渡类型

One minor detail is that the Boomerangs actually come out from the side in this prototype, whereas in the real app they come from the bottom. Screens in Origami support both of these transition types.

一个小细节,在这个原型中 Screen Boomerangs 页面是从右像左显示,而在真实的应用中是从下往上显示。Origami 支持这两种切换类型。

Go to the Transition property of our Screen Boomerangs and it from from Push to Modal.

选中 Screen Boomerangs 图层,将属性 Transition 的值从 Push 改为 Modal。

Now clicking on the thumbnail should bring Screen Boomerangs up from the bottom, and tapping on the cross should bring Screen Boomerangs back down.

再试着点击一下,Screen Boomerangs 从下往上显示,从上往下关闭。

Finishing the flow 整理流程

Our last Screen is a closer look at the first thumbnail, called Screen Share. Like before, a Hit Area has already been prepared for this, called Open Share.

最后一个屏幕叫 Screen Share ,是放大列表中的第一个图。跟前面一样,已经有一个叫 Open Share 的热区,在 Screen Boomerangs 下的 Boomerangs 组内。

Add this Screen to our flow by hovering over Open Share, clicking on Touch, and then clicking on Tap. Like before, connect the Tap output of this to Present Screen Share.

给热区 Open Share 添加一个 Tap 交互。将 Tap 输出口连接到 Screen Share 图层的 Present 属性。

Tapping on the first thumbnail should now take us to the Share Screen. The last screen transition we want to add is returning back to Screen Boomerangs.

点击第一张图现打开 Screen Share 。最后要在 Screen Share 页面上添加一个返回到 Screen Boomerangs 页面的交互。

Again we've already set up a Hit Area for this under Screen Share called Dismiss Share. Hover over Dismiss Share, click Touch, and then click Tap. Connect the Tap output of this new Interaction to Dismiss Screen Share.

找到 Screen Share 组内名为 Dismiss Share 的热区,给这个热区添加 Tap 交互,连接到 Screen Share 的 Dismiss 属性。

Interaction within screens 屏幕间的交互

We should have our whole screen flow worked out now. Anything we want to do within screens is just as easy.

整个流程就完成了。想在屏幕里添加其他的交互也很简单。

For example, we can make the Boomerangs grid scrollable. The Boomerangs layer itself goes beyond the height of the Viewer, with a few more thumbnails.

例如,让 Boomerangs 页面的列表可以滚动。Boomerangs 组的高度需要超出屏幕。

Open Screen Boomerangs in the Layers panel. Hover over the Boomerangs layer, click on Touch, and then click Scroll Y.

展开图层窗口中的 Screen Boomerangs 组。给 Boomerangs 图层添加 Scroll Y 交互。

Scroll Y because this will be a vertical Scroll

Offset 偏移

Offset within screen transitions is a standard iOS Push transition behavior, however not crucial to creating screen flows. To create an offset in this prototype we need to first know what the Screen Share offset is.

屏幕切换过程中的偏移是标准的 iOS 转换行为,但对创建屏幕流程没有影响,只是一些细节性的😊东西。

板栗:那偏移到底是啥呢,先完成下面的操作,最后再对比一下就知道了。

Hover over Screen Share, click on Touch, and then click the X Offset output.

给 Screen Share 图层组添加一个 X Offset 交互。

We can interact with both inputs and outputs. 打开和关闭时都有偏移效果。

You might offset change as we go between the two screens. Connect this outputted value to the X Offset property of the Screen Boomerangs by clicking and dragging into the Layers panel.

将 X Offset 模块的输出口连接到 Screen Boomerangs 模块的 X Offset 属性。

Now when we go between screens, the outputted Screen Share Offset affects the Screen Boomerangs Offset input too.

现在,从 Screen Boomerangs 页面打开 Screen Share 页时,除了 Screen Share 页面是从右往左打开,下面的 Screen Boomerangs 页面也会有一个从右往左退出的动画,但是运动幅度要比上面的页面小。

板栗:可以断开两个 X Offset 的连接打开-关闭,再连接上两个 X Offset 打开-关闭,对比一下就知道区别了。


相关教程

5. 滚动 Scrolling Views
滚动页面。

9. 多个状态切换 Multiple States
在两个以上的状态之间切换,如 Tab 栏。


相关案例

18. Instagram Boomerang
屏幕和滚动之间的转换。


相关模块

Interaction Scroll


相关图层

Hit Area Screen


NEXT UP
Timed Animations 延时动画


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,937评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,503评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,712评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,668评论 1 276
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,677评论 5 366
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,601评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,975评论 3 396
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,637评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,881评论 1 298
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,621评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,710评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,387评论 4 319
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,971评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,947评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,189评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 44,805评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,449评论 2 342

推荐阅读更多精彩内容