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
// 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 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 roundToDecimal( number, decimalPlaces ){ | |
var multiplier = Math.pow( 10, decimalPlaces ); | |
return Math.round( number * multiplier ) / multiplier; | |
} | |
function roundNearest( number, nearest ){ | |
return Math.round( number / nearest ) * nearest; | |
} |
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
drawDottedLine( new Point( 0, 0 ), new Point( 500, 100 ), 0x000000, 1, 3, 0, 1 ); | |
function drawDottedLine( _p1:Point, _p2:Point, _color:uint = 0x000000, _thickness:Number = 1, _gap:Number = 10, _offset:Number = 0, _percent:Number = 1 ):void{ | |
var line:MovieClip = new MovieClip(); | |
addChild( line ); | |
var distance:Number = distance( _p1, _p2 ); |
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
// Cuepoints for non flvs | |
var dirtyVideoListerner:Function = function (_ns:NetStream, _time:Number, _func:Function):void | |
{ | |
this.addEventListener(Event.ENTER_FRAME, checkTime); | |
var callingMC:MovieClip = this; | |
function checkTime():void | |
{ | |
if (_ns.time > _time) |
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 randomInt(min,max) { | |
return Math.floor( min + Math.random() * (max - min + 1) ) | |
} |
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 clamp( value, min, max ){ | |
return Math.min( Math.max( value, min ), max ); | |
} |
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 randomRange(min, max) { | |
return min + Math.random() * (max - min); | |
} | |
function randomWeightedRange(min, max, expo) { | |
return toDecimal(((Math.random() * (max - min)) + min), expo); | |
} | |
function randomInt(min, max) { | |
return Math.floor(min + Math.random() * (max - min + 1)); |
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
Object.getOwnPropertyNames(Math).map(function(p) { | |
window[p] = Math[p]; | |
}); | |
// So instead of Math.random(), just use random(); |
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 proportionalResizeToFit(resizingMC:Object, referenceMC:Object, useHeight:Boolean){ | |
var origWidth:Number = resizingMC.width; | |
var origHeight:Number = resizingMC.height; | |
var ratio:Number = origHeight / origWidth; | |
if (useHeight){ | |
resizingMC.height = referenceMC.height; | |
resizingMC.width = resizingMC.height / ratio; | |
} else { |
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 randomChars:String = "A_B_C_D_E_F_G_H_I_J_K_L_M_N_O_P_!_@_#_$_%_^_&_!_ _ _ _ _ _ _" | |
var charArray:Array = randomChars.split("_"); | |
function descramble(speed:int, txt:TextField):void{ | |
var originalString:String = txt.text; | |
var newFragment:String; | |
var newString:String; | |
var characterNum:int = 0; |
OlderNewer