Knob

Introduced in 1.1.0

The knob control is very configurable. This table lists the methods available and the sketch below gives you the chance to experiment with some of these options.

limits(l0, l1) The 2 parameters limit the values that can be returned by the knob. Limits should be set before the knob value.
value(v) Sets the value of the knob and hence its rotation indicated by the marker. Values will be constrained to the knob limits which is why they should be set first.
ticks(major, minor, sticky) major is the number of domains the track will be split into and they will be separated by big tick marks.
minor is the number of sub domains the major domains are split into and they will be separated by small tick marks.
sticky is an optional bbolean value, if true the thunb position will be constrained
track(width) Sets the width of the track surrounding the central knob-grip. The value will be constrained so the width between 6 pixels (minimum) upto the radius of the knob. The track is used to display current value bar as well as any user specified ticks.
turnAngle(ang) Sets the maximum angle the knob can be turned in degrees. Angles outside the range >0° and ≤360° will be ignored and the current turn angle is unchanged.
mode(mode) Sets the interaction mode (mouse and touch) for rotating the knob.
  • 'x' : dragging left and right turns the knob anticlockwise and clockwise respectively.
  • 'y' : dragging down and up turns the knob anticlockwise and clockwise respectively.
  • 'a' : dragging round the knob center turns the knob to face the drap point.
Rotation is constrained within the maximum turn angle for this knob.
Any other parameter value is ignored and the mode is unchanged.
sensitivity(svty) Only applies to modes 'x' and 'y'. It controls how far the knob rotates for a given drag distance.
The drag distance needed to rotate the knob by the maximum turn angle is the reciprocal of the parameter value i.e. 1.0 / svty.
The default value is 0.005 which equates to a drag distance of 200 pixels and the minimum permitted value is 0.0025 (400 pixels).
gap(ang) If the turn angle is <360° then there will be an 'unused' section of track. This is called the gap and this method sets the position of the gap center effectively rotating the whole knob.
The angle is 0° along positive x-axis and increases clockwise. The default value is 90° which means the gap center faces south.

In the sketch below you have a chance experiment and see the effect of some of these attributes.