sS html_humDemo() {
ret htitle("Hum demo")
//+ loadJQuery()
+ loadJQuery2()
+ hjs_playHum()
+ hjs([[
console.log("$: " + $);
console.log("easing: " + $.easing);
$.extend($.easing, {
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function(x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
}
});
function fadeIn() {
hum(0);
fadeTo(1);
}
function fadeOut() {
fadeTo(0);
}
function fadeTo(vol) {
$(humSound).animate({ // call animate on the object
volume: vol // specify the t property of the object to be animated
}, {
duration: vol < humSound.volume ? 250 : 500,
easing: vol < humSound.volume ? 'easeOutExpo' : 'easeInOutQuint'/*'easeInExpo'*/,
step: function(value) { hum.volume = value; }
});
}
]])
+ hbutton_onClick("Silent", "hum(0)")
+ hbutton_onClick("Low", "hum(0.25)")
+ hbutton_onClick("Med", "hum(0.5)")
+ hbutton_onClick("Full", "hum(1)")
+ hbutton_onClick("Fade in", "fadeIn()")
+ hbutton_onClick("Fade out", "fadeOut()");
}