Switch
Remember state (on or off). Switch patches are like light switches. They can be off or on and are useful when building simple two-state interactions (showing and hiding comments in a popover, for example).
The Switch patch’s Flip port is useful when one interaction type is used to control the switch. For example, if repeatedly tapping a photo zooms it between a large and small size, the Switch patch can be used to hold the current zoom state (in or out). Simply connect the Switch patch’s Flip input port to the Tap output of the photo’s Interaction patch.
The Switch patch’s On and Off ports are useful when different types of interactions control the switch. For example, in a compose window, a Compose button might turn on the switch and the Cancel and Done buttons might turn off the switch.
See State Basics for more information.
Switch
- Flip
- Turn On
- Turn Off
- On / Off
- Flip
A pulse that flips the state of the switch (from on to off, or vice versa).
- Turn On
A pulse that turns the switch on. If the switch is already on, the pulse has no effect.
- Turn Off
A pulse that turns the switch off. If the switch is already off, the pulse has no effect.
- On / Off
A boolean that is true if the switch is on.