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
private function setRegistration(obj:DisplayObject):void | |
{ | |
obj.x = -obj.width >> 1; | |
obj.y = -obj.width >> 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 bringToFront(obj:DisplayObject):void | |
{ | |
var pos:Number = this.getChildIndex(obj); | |
while(pos < this.numChildren - 1) | |
{ | |
var next:DisplayObject = this.getChildAt(pos + 1) as DisplayObject; | |
this.swapChildren(obj, next); | |
pos = this.getChildIndex(obj); | |
} |
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 bmd:BitmapData = new BitmapData(myBitmap.height, myBitmap.width, false, 0x000000); | |
var matrix:Matrix = new Matrix(); | |
matrix.translate(-myBitmap.width / 2, -myBitmap.height / 2); | |
matrix.rotate(90 * (Math.PI / 180)); | |
matrix.translate(myBitmap.height / 2, myBitmap.width / 2); | |
bmd.draw(myBitmap, matrix); | |
var bm:Bitmap = new Bitmap(bmd); | |
var sp:Sprite = new Sprite(); | |
sp.addChild(bm); | |
addChild(sp); |
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
//////////////////////////////////////////////////////////////////////////////// | |
// | |
// BUILT BY EDGAR | |
// | |
// Clock.js | |
// | |
// http://builtbyedgar.com/ | |
// https://twitter.com/BuiltByEdgar | |
// https://github.com/BuiltByEdgar | |
// |
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 Vector3( x, y, z ) | |
{ | |
this.x = x; | |
this.y = y; | |
this.z = z; | |
this.tx = 0; | |
this.ty = 0; | |
this.tz = 0; | |
this.sinRX = 0; |
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 millisecondsToSeconds(time) { | |
var m = Math.floor((((time % 31536000) % 86400) % 3600) / 60); | |
var s = (((time % 31536000)% 86400) % 3600) % 60; | |
if (s > 9) { | |
return m + ":" + Math.round(s); | |
} else { | |
return m + ":0" + Math.round(s); | |
} |
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
/* Vertical align */ | |
.verticalcenter{ | |
position: relative; | |
top: 50%; | |
-webkit-transform: translateY(-50%); | |
-o-transform: translateY(-50%); | |
transform: translateY(-50%); | |
} |
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
/* the fix! simply ADD this block BELOW the above block */ | |
@media screen and (-webkit-min-device-pixel-ratio:0) { | |
@font-face { | |
font-family: 'MyWebFont'; | |
src: url('webfont.svg#svgFontName') format('svg'); | |
} | |
} |
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 copy(o){ | |
var copy = Object.create( Object.getPrototypeOf(o) ); | |
var propNames = Object.getOwnPropertyNames(o); | |
propNames.forEach(function(name){ | |
var desc = Object.getOwnPropertyDescriptor(o, name); | |
Object.defineProperty(copy, name, desc); | |
}); | |
return copy; |
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
Array.prototype.sortOn = function() { | |
var b = this.slice(); | |
if (!arguments.length) return b.sort(); | |
var e = Array.prototype.slice.call(arguments); | |
return b.sort(function(b, g) { | |
for (var h = e.slice(), c = h.shift(); b[c] == g[c] && h.length;) c = h.shift(); | |
return b[c] == g[c] ? 0 : b[c] > g[c] ? 1 : -1 | |
}) | |
}; |
OlderNewer