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.
狀態幫助記住原型中信息。脈沖用來告訴模塊反饋哪個動作。了解這些工作方式有助于更有效地構建原型。
板栗:跟電路圖其實差不多。【打開開關 → 電流通過 → 點亮燈泡】:打開 = 交互和操作模塊;開關 = 交互對象模塊;電流通過 = 發送脈沖;點亮燈泡 = 切換為定義的狀態。
States 狀態
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.
狀態是一個值持續的時間。板栗:也就字面意思,跟“今天狀態不好,昨天狀態特別好”一個意思.
舉個例子,最簡單的能實現狀態切換的模塊是 Switch 開關 模塊。在沒有 打開 或 關閉 前,狀態是會保持不變的。
If we look at a state as it changes over time, it might look something like this:
假設開關本來是一個關閉,我們在 Frame 5 那里點了下開關,那狀態圖形化之后可能看起來是下面圖中那樣:
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.
可以看到狀態 Frame 1~4 是關閉的,Frame 5 之后開啟了。
一個幀通常是1/60秒。板栗:這句不用管了,這里說還挺干擾的...
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:
狀態是一個持續時間,脈沖就不是,脈沖只持續一幀,把信息發送到了就撤了。 否則,這條線路就被占用了不能在發送其他的脈沖了。
狀態的可視化圖形大概就下面這樣的:
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 上顯示了一下。用于告訴模塊 趕緊的切換狀態啊!,打開或關閉開關。
脈沖還可用于傳遞用戶交互,例如在屏幕上點擊或按鍵盤上的鍵。
板栗:其實吧我覺得所有的信息都是通過脈沖傳遞的。
Examples of State & Pulses 狀態和脈沖的例子
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 模塊接收一個交互模塊發出的脈沖,根據指令輸出開關的狀態將其打開或關閉。
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 表示手指在屏幕上按下時的狀態,按下時輸出脈沖。Tap 表示手指在屏幕上按下 - 松開時的狀態,松開輸出脈沖。
The Counter patch outputs the state of the counter (the number value) and accepts pulses to increase it or decrease it.
Counter 模塊輸出計數器的狀態(數值)并接受來自其他模塊的脈沖增加或減少數值。
Creating Pulses from State 給狀態創建一個脈沖
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.
有幾種方法從狀態創建脈沖。 更明確的方法是使用[Pulse]模塊。 [Pulse]模塊接受一個稱為On / Off的狀態,并在狀態打開時在Turned On端口輸出脈沖,當狀態關閉時,將輸出Turned Off端口的脈沖。 這是在用戶觸摸屏幕的瞬間翻轉開關的示例。
試了個加Pulse模塊的跟不加的也沒區別啊!!
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.
這兩節不懂
Temporary State with the Delay patch 臨時狀態和 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.
有時你需要一個狀態打開一會兒,然后自動關閉。
這里假設一個交互,用戶按下按鈕后出現確認窗口幾秒鐘,然后自動關閉。
可以使用 Switch 模塊來做到這一點,但是你需要建立“在一段時間后關閉開關”的邏輯,一個更簡單的方法是使用 ** 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 模塊可以采取正在更改的狀態,并將更改延遲時間設置為指定的值。還可以定義類型是有操作就激活,還是只在關閉到打開或打開到關閉時更改。
?? Coordinates 坐標 ? Patches 模塊 - Animation 動畫 - Bouncy Converter ??