Last active
December 14, 2015 21:59
-
-
Save edwerner/5154897 to your computer and use it in GitHub Desktop.
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
this.bindCrossfadeButton = function () { | |
// save scope | |
var that = this; | |
// create button and bind click event | |
$('<a/>', { | |
'class': 'btn btn-primary btn-large demo-audio-btn unselectable button-margin-top' | |
}) | |
.text('cross-fade audio') | |
.appendTo('#examples-docs') | |
.bind('click', function () { | |
that.onCrossfadeButtonClick(); | |
}); | |
}; | |
this.onCrossfadeButtonClick = function () { | |
soundManager.play('ROTARY_PHONE_LOW'); | |
soundManager.adjustVolume('ROTARY_PHONE_HI', 0); | |
soundManager.play('ROTARY_PHONE_HI'); | |
var t1 = setTimeout(function () { | |
soundManager.fadeMute('ROTARY_PHONE_LOW', 2000, true, false); | |
soundManager.fadeUnmute('ROTARY_PHONE_HI', 2000, true, false); | |
clearTimeout(t1); | |
}, 4000); | |
var t2 = setTimeout(function () { | |
soundManager.stop('ROTARY_PHONE_LOW'); | |
soundManager.fadeMute('ROTARY_PHONE_HI', 2000, true, false); | |
clearTimeout(t2); | |
}, 6000); | |
var t3 = setTimeout(function () { | |
soundManager.stop('ROTARY_PHONE_HI'); | |
soundManager.adjustVolume('ROTARY_PHONE_LOW', 1); | |
clearTimeout(t3); | |
}, 8000); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment