Dosen原創(chuàng)
這是我學(xué)習(xí)quartz composer疼鸟,Origami空镜,看官方文檔翻譯下來的捌朴,每天一篇,有不準(zhǔn)確的地方希望能指出洼怔,一起交流進(jìn)步茴厉。轉(zhuǎn)載請與我聯(lián)系什荣,擅自轉(zhuǎn)載視作侵權(quán)。
Interactions ? ? ?交互
Interaction patches give you information about user interactions like touches, clicks, swipes, and key presses in the viewer.
交互模塊給你用戶在查看器中的交互信息嗜闻,像觸摸桅锄,點(diǎn)擊,滑動翠肘,按鍵辫秧。
1. Interaction patches ? ? ?交互模塊
Interaction 2 →?“?I ” ? ? ? 交互2
This is the bread and butter of interaction in Origami. It can tell you when a user touches down, touches up, taps (a touch down and up in quick succession), and drags (a touch down that moves). It works well with Layer Groups.
Interaction 2在Origami的交互中很重要。它可以告訴你用戶什么時(shí)候按下甥桂,抬起邮旷,輕擊(落下接著快速抬起),拖動(落下移動)办陷。它和Layer Groups配合效果很好狡孔。
Scroll →? ? ? ? 滾動
Lets you scroll a Layer (center-anchored) with momentum and rubberbanding. All it needs to know is the size of the Image you are scrolling, and the type of scrolling you want (Free, Paging, or Wheel of Fortune). Also, see Desktop Scroll →
Scroll讓你有彈力有慣性的滾動一個(gè)層(錨點(diǎn)在中心)苗膝。它需要知道你滾動的圖片的尺寸和你想要滾動的方式(自由,翻頁离唐,或者轉(zhuǎn)盤式)问窃。
Swipe →? ? ? ? 滑動
This helps you quickly prototype swiping a layer between two positions. Some examples of UIs you can build with this: swiping down to close a dialog, pull-to-refresh, swiping up to reveal a list of options (like 3D Touch Peek and Pop), swiping right to go back, and swiping horizontally to switch between a camera's photo and video modes.
Swipe可以幫助你快速原型展示在兩個(gè)位置間滑動圖層。一些UI的例子你可以用它來創(chuàng)建:向下滑動關(guān)閉一個(gè)對話嵌戈,下拉刷新听皿,向上滑動顯示菜單,向右滑動返回庵朝,水平滑動切換攝像頭的照片和錄像模式又厉。
Keyboard →?“?K ” ? ? ? 鍵盤
Lets you know when a specific key on your Mac's keyboard is pressed in the viewer. For mobile prototypes, this lets you set up hot keys that configure your prototype into specific states for easy demoing. Assign it to a key using the settings inspector, or by hovering over the patch and pressing a key on your keyboard.
Keyboard能讓你在查看器中知道覆致,在你mac的鍵盤上的一個(gè)特定的按鍵被按下。對于手機(jī)原型來說儡羔,這可以讓你設(shè)置快捷鍵,方便展示原型中特殊的狀態(tài)笔链。使用設(shè)置檢查器給它指定一個(gè)按鍵鉴扫,或者懸停在模塊上并在鍵盤上按下一個(gè)鍵澈缺。
2. Interaction ports ? ? ?交互接口
One thing you'll notice with some interaction patches (Interaction 2, Scroll, Swipe) is they have an extra unlabeled port at the top right. That allows you to specify a specific layer to get interactions from, rather than anywhere on screen. Just connect it to the interaction port at the top left of a Layer.
你會注意到一些交互模塊(Interaction 2姐赡,Scroll,Swipe)项滑,它們在右上方有一些額外的沒有標(biāo)簽的接口枪狂。那個(gè)地方允許你指定一個(gè)特殊的層去獲取交互在哪,而不是屏幕上的任何地方辜限,只需要連接它到一個(gè)層的左上角的交互接口上严蓖。
3. Layer order and grouping affects touch detection ? ? ?層的順序和組影響觸摸監(jiān)測
Once you've tied an interaction to a Layer, you will only get interactions if that Layer is the front-most layer at that position. Change layer order with the dropdown in the top-right of a Layer patch, or select the layer and hit “ ? [ ” or “ ? ] ” .
給一個(gè)層綁定一個(gè)交互,只有這個(gè)層是最頂層的情況下毫深,才可以交互杭措。下拉層模塊右上角可以改變層順序,或者選擇層并按“ ? [ ” or “ ? ] ”手素。
第一句沒按原文翻譯,大概意思應(yīng)該差不多稿黍。
Likewise, if you have Layers inside a Layer Group, you will only get interactions for the front-most Layer you are touching. To get interactions on an entire Layer Group itself, simply add Interaction 2 patches to each Layer within, and toggle their Enable ports off. This tells Origami that you don't want those layers to be interactive.
同樣的巡球,如果你在一個(gè)層組里還有一些層,你將只能獲取到你觸摸到的最頂層的交互酣栈。想獲得整個(gè)層組的交互,給各個(gè)層添加Interaction 2模塊矿筝,并將它們的Enable接口關(guān)閉。這樣就告訴了Origami你不想那些層被交互榆综。