States help remember information in your prototype. Pulses are used to tell patches to perform an action. Understanding how these work together will help you be more effective at building Origami prototypes.
狀態(tài)幫助記住原型中信息。脈沖用來(lái)告訴模塊反饋哪個(gè)動(dòng)作。了解這些工作方式有助于更有效地構(gòu)建原型。
板栗:跟電路圖其實(shí)差不多。【打開開關(guān) → 電流通過(guò) → 點(diǎn)亮燈泡】:打開 = 交互和操作模塊;開關(guān) = 交互對(duì)象模塊;電流通過(guò) = 發(fā)送脈沖;點(diǎn)亮燈泡 = 切換為定義的狀態(tài)。
States 狀態(tài)
A state is a value that persists over time. The simplest version of state is in the Switch patch. Switches are either on or off, and they remain that way until you tell them otherwise.
狀態(tài)是一個(gè)值持續(xù)的時(shí)間。板栗:也就字面意思,跟“今天狀態(tài)不好,昨天狀態(tài)特別好”一個(gè)意思.
舉個(gè)例子,最簡(jiǎn)單的能實(shí)現(xiàn)狀態(tài)切換的模塊是 Switch 開關(guān) 模塊。在沒(méi)有 打開 或 關(guān)閉 前,狀態(tài)是會(huì)保持不變的。
If we look at a state as it changes over time, it might look something like this:
假設(shè)開關(guān)本來(lái)是一個(gè)關(guān)閉,我們?cè)?Frame 5 那里點(diǎn)了下開關(guān),那狀態(tài)圖形化之后可能看起來(lái)是下面圖中那樣:
A switch is off until you turn it on. You can see the state goes from off to on immediately in a single frame. A frame is usually 1/60th of a second.
可以看到狀態(tài) Frame 1~4 是關(guān)閉的,F(xiàn)rame 5 之后開啟了。
一個(gè)幀通常是1/60秒。板栗:這句不用管了,這里說(shuō)還挺干擾的...
Pulses 脈沖
While state persists over time, pulses are On ? only for a single frame. The value of the cable sending the pulse is otherwise off.
A pulse over time looks like this:
狀態(tài)是一個(gè)持續(xù)時(shí)間,脈沖就不是,脈沖只持續(xù)一幀,把信息發(fā)送到了就撤了。 否則,這條線路就被占用了不能在發(fā)送其他的脈沖了。
狀態(tài)的可視化圖形大概就下面這樣的:
our can see that pulses are only On ? for a single frame.
They're used to tell patches to perform an action, like telling a Switch to turn on or turn off. They're also useful for passing along user interactions like tapping on the screen or pressing a key on the keyboard.
可以在圖上看到脈沖只在 Frame 5 上顯示了一下。用于告訴模塊 趕緊的切換狀態(tài)啊!,打開或關(guān)閉開關(guān)。
脈沖還可用于傳遞用戶交互,例如在屏幕上點(diǎn)擊或按鍵盤上的鍵。
板栗:其實(shí)吧我覺(jué)得所有的信息都是通過(guò)脈沖傳遞的。
Examples of State & Pulses 狀態(tài)和脈沖的例子
The [Switch] patch outputs the state of the switch (on / off) and accepts pulses to flip the switch, turn it on, or turn it off.
Switch 模塊接收一個(gè)交互模塊發(fā)出的脈沖,根據(jù)指令輸出開關(guān)的狀態(tài)將其打開或關(guān)閉。
The Interaction patch has Down and Tap outputs. Down represents the state of whether the finger is currently down on the screen. The Tap port outputs a pulse when the finger is released from the screen.
Interaction 模塊有 Down 和 Tap 輸出口。Down 表示手指在屏幕上按下時(shí)的狀態(tài),按下時(shí)輸出脈沖。Tap 表示手指在屏幕上按下 - 松開時(shí)的狀態(tài),松開輸出脈沖。
The Counter patch outputs the state of the counter (the number value) and accepts pulses to increase it or decrease it.
Counter 模塊輸出計(jì)數(shù)器的狀態(tài)(數(shù)值)并接受來(lái)自其他模塊的脈沖增加或減少數(shù)值。
Creating Pulses from State 給狀態(tài)創(chuàng)建一個(gè)脈沖
There are a couple ways to create a pulse from state. The more explicit way is to use the Pulse patch. The Pulse patch accepts a state called On/Off and will output a pulse on the Turned On port when the state turns on and the Turned Off port when the state turns off. This is an example that flips a switch the moment the user touches the screen.
有幾種方法從狀態(tài)創(chuàng)建脈沖。 更明確的方法是使用[Pulse]模塊。 [Pulse]模塊接受一個(gè)稱為On / Off的狀態(tài),并在狀態(tài)打開時(shí)在Turned On端口輸出脈沖,當(dāng)狀態(tài)關(guān)閉時(shí),將輸出Turned Off端口的脈沖。 這是在用戶觸摸屏幕的瞬間翻轉(zhuǎn)開關(guān)的示例。
試了個(gè)加Pulse模塊的跟不加的也沒(méi)區(qū)別啊!!
Another way is to infer a state change is to connect a state directly to a port accepting a pulse. What'll happen is the port that accepts a pulse will look to when the state changes from off to on, and at that moment infer a pulse. So if you wanted a switch to flip when the user's finger touches down on the screen, you can connect the Down port directly to the Switch's Flip port, without needing to use a Pulse patch.
這兩節(jié)不懂
Temporary State with the Delay patch 臨時(shí)狀態(tài)和 Delay 模塊
Sometimes you need a state to turn on for a few moments and then turn off. For example, say you were making a confirmation window appear for a couple seconds after the user pressed a button. You could do this using a Switch, but then you'd need to build logic that turns the switch off after some time. A simpler way to do this is to use the Delay patch.
有時(shí)你需要一個(gè)狀態(tài)打開一會(huì)兒,然后自動(dòng)關(guān)閉。
這里假設(shè)一個(gè)交互,用戶按下按鈕后出現(xiàn)確認(rèn)窗口幾秒鐘,然后自動(dòng)關(guān)閉。
可以使用 Switch 模塊來(lái)做到這一點(diǎn),但是你需要建立“在一段時(shí)間后關(guān)閉開關(guān)”的邏輯,一個(gè)更簡(jiǎn)單的方法是使用 ** Delay D
**模塊替換 Switch。
The Delay patch can take state that's changing and delay the change by an amount of time you specify. You can also tell it whether to only delay increasing (off to on) or decreasing (on to off) changes. If you give a Delay patch a pulse as input, you can delay the change from on to off, extending the pulse for any amount of time you'd like.
Delay 模塊可以采取正在更改的狀態(tài),并將更改延遲時(shí)間設(shè)置為指定的值。還可以定義類型是有操作就激活,還是只在關(guān)閉到打開或打開到關(guān)閉時(shí)更改。
?? Coordinates 坐標(biāo) ? Patches 模塊 - Animation 動(dòng)畫 - Bouncy Converter ??