Skip to content

Instantly share code, notes, and snippets.

Avatar
🥸

André Pessoa AndrePessoa

🥸
View GitHub Profile
View audioClass
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 },
],
View gist:0d2537f71d2be6673a0541cfa939937a
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
@AndrePessoa
AndrePessoa / my_add_remove_class
Created Oct 5, 2016
Add/remove class pessoal
View my_add_remove_class
// 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;
}
@AndrePessoa
AndrePessoa / random.js
Last active Mar 11, 2016 — forked from kerimdzhanov/random.js
Javascript get random number in a specific range
View random.js
/**
* 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);
}