jQuery Kontrol Test

by firegroove

HTML

<script src="http://anthonyterrien.com/js/jquery.kontrol.js"></script>
<input type="text" class="xy" value='{"x": 50, "y": 67}' data-width=180 data-height=180>

JavaScript

var context = new webkitAudioContext();
var osc = context.createOscillator();
var gain = context.createGain();
osc.connect(gain);
gain.connect(context.destination);
osc.noteOn(0);
gain.gain.value = 0;

$(".xy")
    .xy({
    //displayPrevious: false,
    min: 0,
    max: 255,
    fgColor: "#222222",
    bgColor: "#EEEEEE",
        'change' : function(x){
        gain.gain.value = 1;
        //osc.frequency.value = v;
        console.log(x);   
        
        },
        'release' : function(){
        gain.gain.value = 0;
        }
})
    .css({
    'border': '5px solid #DDD'
});