here's an even simpler (less formulaic?) way to achieve 2D panning:
( full code here )
<input type="range" name="pan" id="pan" min="-1" max="1" step="any" />
<script>
var panner = context.createPanner();
panner.panningModel = 'equalpower';
function pan(event) {
var x = this.valueAsNumber,
y = 0,
z = 1 - Math.abs(x);
panner.setPosition(x,y,z);
}
document.getElementById('pan').addEventListener(pan);
</script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…