Switch

An on/off toggle. Bind Checked to a Boolean variable and it drives or follows it.

Group: Controller · Default size: 50 × 25 · Style parts: Main, Indicator, Knob

A dropped Switch: a small grey track with a white knob on the left.
A Switch as it is dropped, off.
The Switch settings section: Checked unticked, Anim time 0 ms.
Its settings.
SettingDefaultWhat it does
CheckedoffInitial state.
Anim time0 msHow long the knob takes to slide.

Example: a switch that lights a lamp

  1. On the Data tab add a variable called lamp with Type Boolean.
  2. Drag a Switch onto the screen and name it LampSwitch. Under Data bindings add a binding: Variable lamp, Drives Checked, Direction Widget -> variable.
  3. Drag an LED beside it, name it Lamp and set LED settings > Colour to #FFB300. Add a binding: Variable lamp, Drives Opacity, Formula 40 + raw * 215 - faint at 0, whole at 1.
  4. Press Preview and click the switch.
Preview: the switch off and the lamp beside it pale.
Off: the lamp is faint.
Preview: the switch on, its track blue, and the lamp beside it bright amber with a glow.
On: the lamp is lit.
The switch's Data bindings: Variable lamp, Drives Checked, Direction Widget -> variable.
The switch writes the variable.
The lamp's Data bindings: Variable lamp, Drives Opacity, Formula 40 + raw * 215.
The lamp reads it, through a formula.