#N canvas 1130 70 396 194 10;
#X obj 109 40 inlet;
#X obj 109 124 outlet;
#X obj 109 61 t b b;
#X obj 136 103 outlet;
#X obj 148 40 inlet;
#X msg 148 61 value \$1;
#X obj 136 82 ofelia d -k \$0-slider;
#A __set local c = ofCanvas(this) \; local args = c:getArgs() \; local
xpos \, ypos \, width \, height \, minVal \, maxVal = args[1] \, args[2]
\, args[3] \, args[4] \, args[5] \, args[6] \; local mouseState = 0
\; local value = 0 \; \; function M.new() \; ofWindow.addListener("mousePressed"
\, this) \; ofWindow.addListener("mouseDragged" \, this) \; ofWindow.addListener("mouseReleased"
\, this) \; end \; \; function M.value(float) \; value = ofNormalize(float
\, minVal \, maxVal) \; return ofLerp(minVal \, maxVal \, value) \;
end \; \; function M.bang() \; ofPushMatrix() \; ofPushStyle() \; ofSetRectMode(OF_RECTMODE_CORNER)
\; ofFill() \; ofSetColor(255) \; ofDrawRectangle(xpos \, ypos \, width
\, height) \; ofTranslate(0 \, - value * height + height) \; ofSetColor(100
\, 200 \, 255) \; ofDrawRectangle(xpos \, ypos \, width \, value *
height) \; ofPopMatrix() \; ofPushMatrix() \; ofSetLineWidth(2) \;
ofNoFill() \; ofSetColor(0) \; ofDrawRectangle(xpos \, ypos \, width
\, height) \; ofPopStyle() \; ofPopMatrix() \; end \; \; function M.free()
\; ofWindow.removeListener("mousePressed" \, this) \; ofWindow.removeListener("mouseDragged"
\, this) \; ofWindow.removeListener("mouseReleased" \, this) \; end
\; \; function M.mousePressed(e) \; if ofGetMouseX() > xpos and ofGetMouseX()
< xpos + width and ofGetMouseY() > ypos and ofGetMouseY() < ypos +
height then \; mouseState = 1 \; float = ((-ofGetMouseY() + height
+ ypos) * ((maxVal - minVal) / height)) + minVal \; value = ofNormalize(float
\, minVal \, maxVal) \; return ofLerp(minVal \, maxVal \, value) \;
end \; end \; \; function M.mouseDragged(e) \; if mouseState == 1 then
\; float = ((-ofGetMouseY() + height + ypos) * ((maxVal - minVal) /
height)) + minVal \; value = ofNormalize(float \, minVal \, maxVal)
\; return ofLerp(minVal \, maxVal \, value) \; end \; end \; \; function
M.mouseReleased(e) \; mouseState = 0 \; end \;;
#X f 22;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 2 1 6 0;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 6 0 3 0;
