Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Knob Element Interface

janesconference edited this page Dec 8, 2011 · 2 revisions

The Knob Element is a simple control knob with a single value that ranges from 0 to 1. A knob can be controlled by the user clicking on it and dragging it up and down. A series of ordered images (frames) is used to display the various knob states. The Knob interface is defined in Knob.js.

Constructor

Knob.prototype.getready = function (args) // {Object}

Constructor arguments (args).

Other than the Graphical Element Interface constructor parameters, Knob has some unique parameters:

  • sensitivity {Int}: sensitivity parameter for the knob, or how much dragging affects change in the internal value of the knob.
  • imagesArray {Array}: An array of images, ordered from the frame associated with the lowest value (0) to the frame associated with the highest (1).

Properties and slot

  • values.knobvalue {Int}: The knobvalue of a knob reflects its internal state. It ranges from 0 to 1.
  • defaultSlot {String = 'knobvalue'}: The default slot of a knob is its only slot, called 'knobvalue'.

Methods

_getImageNum()

Knob.prototype._getImageNum = function ()

This method translates from the internal knob value to the index of the image (in the imagesArray array) that should be used to draw the knob in its current state.
The return value is a Integer, ranging from 0 to imagesArray.length - 1.

_getImage

Knob.prototype._getImage = function ()

This method returns the image, from the imagesArray array, that should be used to draw the knob in its current state. The return value is an Image object.