Last active
October 22, 2017 23:47
-
-
Save beefchimi/792a7b6ed88fbea52d934f2084414c18 to your computer and use it in GitHub Desktop.
Swappable audio snippet
This file contains hidden or 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
let swappedNode = null; | |
draggable.on('drag:start', () => { | |
SoundFx.Synth.play('up'); | |
}); | |
draggable.on('swappable:swapped', ({swappedElement}) => { | |
swappedNode = swappedElement; | |
SoundFx.Synth.play('swap'); | |
}); | |
draggable.on('drag:stop', () => { | |
if (swappedNode) { | |
SoundFx.Synth.play('downGood'); | |
} else { | |
SoundFx.Synth.play('downBad'); | |
} | |
swappedNode = null; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment