Fader

Fader objects are created using the following functions.  Faders are drawn between a starting point (x1, y1) and an ending point (x2, y2).

There are two types of faders, a horizontal fader (HFader) and a vertical fader (VFader).

HFader(x1, y1, x2, y2, minValue, maxValue, startValue, updateFunction, foreground, background, outline, thickness) Creates a horizontal fader from point x1, y1, to point x2, y2.

  • minValue is the smallest possible value (default is 0).
  • maxValue is the largest possible value (default is 999).
  • startValue is the initial fader setting (default is half way).
  • updateFunction specifies what to do when the fader is moved.
  • foreground is the active level color (default is Color.RED).
  • background is the background color (default is Color.BLACK).
  • outline is the outline color (default is Color.BLACK).
  • thickness is the outline thickness in pixels (default is 3).
VFader(x1, y1, x2, y2, minValue, maxValue, startValue, updateFunction, foreground, background, outline, thickness) Creates a vertical fader.  Everything else is same as above.

You can create a fader as follows:

# function to specify what happens when fader is moved
def printValue(value):
   print value   # replace this with whatever needs to happen

fader = VFader(25, 5, 45, 80, 0, 100, 50, printValue)

display1.add(fader)

Once a fader has been created, the following functions are available:

Function Description
fader.getValue() Returns the current value of the fader.
fader.setValue(value) Sets the current value of the fader to value.