Dosen原创
这是我学习quartz composer,Origami,看官方文档翻译下来的,每天一篇,有不准确的地方希望能指出,一起交流进步。转载请与我联系,擅自转载视作侵权。
States 状态
Every prototype has multiple states it can transition between. Origami has several patches to help you manage these states.
每一个原型都有多个状态,并可以在这些状态间转换。Origami有一些模块帮助你管理这些状态。
1. State patches 状态模块
Switch → “ ⇧ S ” 开关
The Switch patch works like a light switch. Flipping it when it's on will turn it off, and when it's off flipping it will turn it on. Switches help you build simple two-state interactions. For example you might have a Switch managing whether a photo is full screen or not or whether a modal view is on screen.
Switch模块的作用像是一个灯的开关。轻击它会在开和关的状态间切换。Switch帮你建立简单的两个状态的交互。例如,你可以用一个Switch管理一个图是否全屏或者一个模型视图是否在屏幕上。
Index Switch → 索引切换
Index Switch patches are useful for mutually exclusive states that cannot coexist, e.g. a tab bar.
Index Switch模块对于相互排斥无法共存的状态非常有用。例如,一个Tab bar(标签栏)。
Index Switches are commonly used with Multiplexers to pass different values depending the state. For example, if you wanted to change a navigation bar title between 3 states:
Index Switch通常和Multiplexers用于依赖状态传递不同的值。例如,你想在3个状态间改变导航栏的标题。
Counter 2 → 计数器
Counter patches are useful for mutually exclusive states that cannot coexist, and increment in a fixed order e.g. an onboarding flow.
Counter模块是对于相互排斥无法共存的状态和固定顺序的增量非常有用(和Index Switch很像),例如:入职流程。
2. Index numbers represent states 索引数字代表状态
Both Switch and Index Switch patches output a number for the state that is active. Switch patches output a 0 (off) or a 1 (on), and Index Switch patches output a number starting from 0 for the first state, to 1 for the 2nd, and so on:
Index 0 → Initial state / Off State
Index 1 → 2nd state / On State
Index 2 → 3rd state
Index 3 → 4th state
...
Switch和Index Switch模块都是给有效的状态输出一个数字,Switch模块输出一个0(关)或1(开),Index Switch模块输出一个数字从0开始代表第一个状态,1代表第二个状态,如此...