Skip to content

Instantly share code, notes, and snippets.

@notepadwebdev
Last active November 21, 2016 19:16
Show Gist options
  • Save notepadwebdev/c9c44a8e86c82645207db5a42a48e9bc to your computer and use it in GitHub Desktop.
Save notepadwebdev/c9c44a8e86c82645207db5a42a48e9bc to your computer and use it in GitHub Desktop.
Set the stereo panner position based on pageX position
// Set the stereo panner position based on pageX position
// pos value will be between -1 and 1
setPan(e) {
let pos = (((this.getEvent(e).pageX / $(window).width())*2)-1);
this.panner.pan = pos;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment