new Dial()
The Dial class makes a circular interactive element that can be turned up or down by moving a marker round.
Methods
draw()
Draws the dial on the canvas.
pair(toneObj, toneObjProperty)
Pairs a dial with a Tone.js object and its property.
Parameters:
Name | Type | Description |
---|---|---|
toneObj |
Object | The Tone.js object to pair the dial with. |
toneObjProperty |
string | The property of the Tone.js object to pair the dial with. |
set_pair_val()
Method to set the value of a property on a Tone.js object based on the value of the dial.
set_val()
Map mouse position to dial value
This method maps the mouse position relative to the dial
to a value between min
and max
properties. The value
is also rounded to the nearest step
if a step
has been
provided in the dial constructor. The value is stored in the
val
property and if a Tone.js object property has been paired
with this dial, the value is also updated on the paired Tone.js
object property.
toggle_moving()
Toggles the moving state of the dial.
touch_check() → {boolean}
Determines whether the current mouse position is within the radius of the dial's center point.
Returns:
- True if the mouse position is within the dial's radius; false otherwise.
- Type
- boolean