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 .
没个圆形都有多种状态,可以在状态间切换。在Origami中,Switch Patch 帮助跟踪你当前所在的状态。就像灯的开关,可以通过交互模块定义的交互在开和关之间切换。
State patches 状态模块
Switch shift
S
开关
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 开关] 模块跟灯的开关一样:开着就开着,关了就关了。这个模块构建简单的两个状态切换交互好使。
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 开关 模块可以和逻辑模块 ([Or 或] , [And 和] , [Not 不算这个] ) 一起使用,再连接到别的模块上。例如打开一个有不同选项的设计用户可以切换(这个例子也不是很明白)。
Option Switch 选项开关
[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] 模块用于值之间相互切换这类不能同时存在的状态,例如 Tab。[Option Switch] 模块通常和 Option Pickers选项选择器 一起使用,以根据不同的值传递不同的状态。
例如:想要在三种不同的状态之间更改导航栏标题:
Counter 计数器
Counter patches are useful for mutually exclusive states that cannot coexist, and increment in a fixed order e.g. an on boarding flow.
[Counter] 模块用于值按固定顺序递增这类不能同时存在的状态,例如一个登记流程。
(板栗:老实说不知道图里的是啥意思🤔)
Index numbers represent states 索引号表示状态
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 开关 和 Option Switch 选项开关 Patch 输出激活状态的数字。 Switch 开关 Patch 输出口是 0 (Off) 或 1 (On), Option Switch 选项开关 Patch输出口数字从0开始,0为第一个接口,Index1为第二个接口,依次类推:
- Index 0 接口1 → Initial state / Off State 初始状态/关闭状态
- Index 1 接口2 → 2nd state / On State 第二个状态 / 打开状态
- Index 2 接口3→ 3rd state 第三个状态
- Index 3 接口4→ 4th state 第四个状态
- ...
(板栗:有补充🙋🏻)
▲ 实际用的时候,Switch 模块的接口名称是Set To 0,跟Index 0功能应该是一样的
Summary 总结
- Manage state with Switch, Option Switch, or Counter
- States are represented with integers, starting from 0
- 使用Switch 开关、Option Switch 选项开关或Counter 计数器 管理状态;
- 状态用从0开始的整数表示。