This file contains hidden or 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
| bilerp(s,t) = t*(s*p3+(1-s)*p2) + (1-t)*(s*p1+(1-s)*p0) |
This file contains hidden or 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
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |
This file contains hidden or 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 mouse = { | |
| down: false, | |
| x: 0, | |
| y: 0 | |
| }; | |
| canvas.onmousedown = function(e) { | |
| mouse.down = true; | |
| return false; | |
| }; |
This file contains hidden or 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
| // Created by STRd6 | |
| // MIT License | |
| // jquery.paste_image_reader.js | |
| (function($) { | |
| var defaults; | |
| $.event.fix = (function(originalFix) { | |
| return function(event) { | |
| event = originalFix.apply(this, arguments); | |
| if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) { | |
| event.clipboardData = event.originalEvent.clipboardData; |
This file contains hidden or 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 type(obj){ | |
| return Object.prototype.toString.call(obj).slice(8, -1); | |
| } |
This file contains hidden or 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 executeFunctionByName(functionName, context /*, args */) { | |
| var args = Array.prototype.slice.call(arguments).splice(2); | |
| var namespaces = functionName.split("."); | |
| var func = namespaces.pop(); | |
| for(var i = 0; i < namespaces.length; i++) { | |
| context = context[namespaces[i]]; | |
| } | |
| return context[func].apply(this, args); | |
| } |
This file contains hidden or 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 Easing = { | |
| easeInQuad: function (t, b, c, d) { | |
| return c*(t/=d)*t + b; | |
| }, | |
| easeOutQuad: function (t, b, c, d) { | |
| return -c *(t/=d)*(t-2) + b; | |
| }, | |
| easeInOutQuad: function (t, b, c, d) { | |
| if ((t/=d/2) < 1) return c/2*t*t + b; |
This file contains hidden or 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
| random: function( min, max ) { | |
| if ( isArray( min ) ) | |
| return min[ ~~( M.random() * min.length ) ]; | |
| if ( !isNumber( max ) ) | |
| max = min || 1, min = 0; |
This file contains hidden or 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 map(_val, _min1, _max1, _min2, _max2) | |
| { | |
| return ((_val - _min1)/(_max1 - _min1)) * (_max2 - _min2) + _min2; | |
| } |
This file contains hidden or 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 Color = function() { | |
| this.r = this.g = this.b = 0; | |
| this.h = this.s = this.l = 0; | |
| this.a = 1; | |
| }; | |
| /** RGB */ | |
| Color.prototype.cssRGB = function() { | |
| return "rgb("+Math.round(255*this.r)+","+Math.round(255*this.g)+","+Math.round(255*this.b)+")"; | |
| }; | |
| Color.prototype.cssRGBA = function() { |