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
var som = { | |
$el: $('#botaoMute'), | |
muted: false, | |
playlist: {}, | |
list: [ | |
{ id:'acerto', url:'./jogos/audio/acerto.mp3', loop: false, volume:1 }, | |
{ id:'erro', url:'./jogos/audio/erro.mp3', loop: false, volume:1 }, | |
{ id:'trilha1', url:'./jogos/audio/trilha1.mp3', loop: true, volume:0.2 }, | |
{ id:'trilha2', url:'./jogos/audio/trilha2.mp3', loop: true, volume:0.2 }, | |
], |
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
function rotate( $el, start, end, time ){ | |
var bb = $el[0].getBBox(); | |
var center = { | |
x: ( bb.width ) / 2 + bb.x, | |
y: ( bb.height ) / 2 + bb.y, | |
}; | |
$({ | |
r: start |
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
// class manipulation from http://www.openjs.com/scripts/dom/class_manipulation.php | |
function hasClass(ele,cls) { | |
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); | |
} | |
function addClass(ele,cls) { | |
if (!this.hasClass(ele,cls)) ele.className += " "+cls; | |
} |
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
/** | |
* Get a random floating point number between `min` and `max`. | |
* | |
* @param {number} min - min number | |
* @param {number} max - max number | |
* @return {float} a random floating point number | |
*/ | |
function getRandom(min, max) { | |
return Math.min( Math.random() * (max - min) + min, max); | |
} |