Last active
November 21, 2016 19:16
-
-
Save notepadwebdev/c9c44a8e86c82645207db5a42a48e9bc to your computer and use it in GitHub Desktop.
Set the stereo panner position based on pageX position
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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