Created
January 9, 2013 16:50
-
-
Save katspaugh/4494718 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
/* | |
5..times( | |
function onEach() { blobColl.split(); }, | |
1000, | |
function onComplete() { | |
for (var i = 0; i < blobColl.blobs.length; i += 1) { | |
blobColl.blobs[i].drawCustomFace = BlobFaces[i]; | |
} | |
} | |
); | |
Infinity.times(function () { | |
var BASE_FORCE = 20; | |
var x = BASE_FORCE - Math.random() * BASE_FORCE * 2; | |
var y = BASE_FORCE - Math.random() * BASE_FORCE * 2; | |
blobColl.blobs[ | |
~~(Math.random() * blobColl.blobs.length) | |
].setForce(new Vector(x, y)); | |
}, { | |
valueOf: function () { | |
return Math.random() * 1000; | |
} | |
}); | |
*/ |
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
Number.prototype.times = function (onEach, delay, onEnd) { | |
var n = this; | |
if (n > 0) { | |
onEach(); | |
window.setTimeout(function () { | |
(n - 1).times(onEach, delay, onEnd); | |
}, delay ? delay.valueOf() : 0); | |
} else { | |
onEnd && onEnd(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment