SuperCollider CLASSES


An extended Slider2D responding to Wacom tablet


TabletSlider2D inherits most of its functionality from Slider2D. Aside from that it receives extended wacom tablet data.

NOTE: TabletSlider2D is only available in Cocoa GUI

Drag-and-drop returns and accepts a Point, describing the current x and y value.

All the mouse actions ( action, mouseDownAction, and mouseUpAction ) receive the following arguments:
viewthe view
xsubpixel location in view
ysubpixel location in view
tiltX0 (max. left) ... 1 (max. right)
tiltY0 (max. down) ... 1 (max. up)
deviceIDAll tablet-pointer events generated in the period between the device entering and leaving tablet proximity have the same device ID. Therefore, when working with multiple tablets / mice, you can match actions by looking at the deviceID.
buttonNumber0 left, 1 right, 2 middle wheel click.
clickCountdouble click, triple click ... most relevant for the mouseDown, but still valid for the dragged and mouseUp
absoluteZthe wheel on the side of some mice
rotationin degrees. Used for example on the "4d mouse", and the "art marker". Note: on Mac OS X 10.4.11 using an Intuos3 tablet with Art Marker, the returned value must be multiplied by 1024 to actually obtain degrees (bug?).

Class Methods

Inherited class methods

Instance Methods

Inherited instance methods


Basic use

var window;
var slider;

window = Window("2DSlider", Rect(100,100, 140 ,140));

slider = TabletSlider2D(window, Rect(20, 20,80, 80))
slider.mouseDownAction = { arg view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount;
    ["down",view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount].postln;
slider.action = { arg view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount;
    [view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount].postln;
slider.mouseUpAction = { arg view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount;
    ["up",view,x,y,pressure,tiltx,tilty,deviceID, buttonNumber,clickCount].postln;

Drag and drop Points

w = Window("TabletSlider2D", Rect(100,100, 500 ,300));
w.view.decorator = FlowLayout(w.view.bounds);

t = TabletSlider2D(w, Rect(20, 20,280, 280))
        .x_(0.5)    // initial location of x
        .y_(1)  // initial location of y
            [\sliderX, sl.x, \sliderY, sl.y].postln;

n =, 200@300);
n.decorator = FlowLayout(n.bounds);

v = { |i| DragBoth(n, Rect(0, i * 20, 200, 20)).align_(\center).background_(Color.rand) }.dup(5);,200@150).string_("hold down cmd and drag points from the slider to the drag slots, or reverse").stringColor_(Color.white);


A sound example


    var w, v,int,synth;

    synth=SynthDef("help-TabletSlider2D",{ arg freq=440,int1=5,int2 = -5,
        var p,c,d,f;,0.45,0.55);,0.45,0.55);,2);[ freq * int1.midiratio + f , freq, freq * int2.midiratio - f],
  ,freq * ffreqInterval.midiratio,rq)
                *, gate, gate)

    w =;

    int = ControlSpec(-48,48,\linear,1);

    v = TabletSlider2D(w,Rect(10,10,380,380));
    v.background =;
    v.knobColor =;
    v.action = { arg view,x,y,pressure,tiltx,tilty;
                \gate, pressure.postln

    v.mouseDownAction = { arg view,x,y,pressure;
                \freq , rrand(30,80).midicps,
                \gate, pressure.postln
    v.mouseUpAction = { arg view,x,y,pressure;
        synth.set( \gate, 0.postln )