Skip to content

Instantly share code, notes, and snippets.

@beefchimi
Last active October 22, 2017 23:47
Show Gist options
  • Save beefchimi/792a7b6ed88fbea52d934f2084414c18 to your computer and use it in GitHub Desktop.
Save beefchimi/792a7b6ed88fbea52d934f2084414c18 to your computer and use it in GitHub Desktop.
Swappable audio snippet
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