Every prototype has multiple states it can transition between. In Origami, Switch patches help keep track of which state you are in. They are like light switches and can be toggled with interaction patches .
沒個圓形都有多種狀態(tài),可以在狀態(tài)間切換蔓彩。在Origami中治笨,Switch Patch 幫助跟蹤你當(dāng)前所在的狀態(tài)。就像燈的開關(guān)赤嚼,可以通過交互模塊定義的交互在開和關(guān)之間切換旷赖。
State patches 狀態(tài)模塊
Switch shift
S
開關(guān)
The [Switch] patch is like a light switch: turning it on keeps it on, and turning it off keeps it off. They are helpful to build simple two-state interactions, e.g. showing and hiding comments in a popover.
[Switch 開關(guān)] 模塊跟燈的開關(guān)一樣:開著就開著,關(guān)了就關(guān)了更卒。這個模塊構(gòu)建簡單的兩個狀態(tài)切換交互好使等孵。
Multiple Switch patches can combined with Logic patches ([Or] , [And] , [Not] ) to build on top of each other, e.g. opening a composer with different attachment options which the user can toggle.
多個Switch 開關(guān) 模塊可以和邏輯模塊 ([Or 或] , [And 和] , [Not 不算這個] ) 一起使用,再連接到別的模塊上蹂空。例如打開一個有不同選項的設(shè)計用戶可以切換(這個例子也不是很明白)俯萌。
Option Switch 選項開關(guān)
[Option Switch] patches are useful for mutually exclusive states that cannot coexist, e.g. a tab bar. Option Switches are commonly used with [Option Pickers] to pass different values depending the state.
For example, if you wanted to change a navigation bar title between 3 states:
[Option Switch] 模塊用于值之間相互切換這類不能同時存在的狀態(tài),例如 Tab上枕。[Option Switch] 模塊通常和 Option Pickers選項選擇器 一起使用咐熙,以根據(jù)不同的值傳遞不同的狀態(tài)。
例如:想要在三種不同的狀態(tài)之間更改導(dǎo)航欄標(biāo)題:
Counter 計數(shù)器
Counter patches are useful for mutually exclusive states that cannot coexist, and increment in a fixed order e.g. an on boarding flow.
[Counter] 模塊用于值按固定順序遞增這類不能同時存在的狀態(tài)辨萍,例如一個登記流程棋恼。
(板栗:老實說不知道圖里的是啥意思??)
Index numbers represent states 索引號表示狀態(tài)
Both Switch and Option Switch patches output a number for the state that is active. Switch patches output a 0 (off) or a 1 (on), and Option Switch patches output a number starting from 0 for the first state, to 1 for the 2nd, and so on:
Switch 開關(guān) 和 Option Switch 選項開關(guān) Patch 輸出激活狀態(tài)的數(shù)字。 Switch 開關(guān) Patch 輸出口是 0 (Off) 或 1 (On)锈玉, Option Switch 選項開關(guān) Patch輸出口數(shù)字從0開始爪飘,0為第一個接口,Index1為第二個接口,依次類推:
- Index 0 接口1 → Initial state / Off State 初始狀態(tài)/關(guān)閉狀態(tài)
- Index 1 接口2 → 2nd state / On State 第二個狀態(tài) / 打開狀態(tài)
- Index 2 接口3→ 3rd state 第三個狀態(tài)
- Index 3 接口4→ 4th state 第四個狀態(tài)
- ...
(板栗:有補(bǔ)充????)
▲ 實際用的時候,Switch 模塊的接口名稱是Set To 0牧氮,跟Index 0功能應(yīng)該是一樣的
Summary 總結(jié)
- Manage state with Switch, Option Switch, or Counter
- States are represented with integers, starting from 0
- 使用Switch 開關(guān)、Option Switch 選項開關(guān)或Counter 計數(shù)器 管理狀態(tài)抡诞;
- 狀態(tài)用從0開始的整數(shù)表示穷蛹。