var App = function(jquery) { if(jquery !== false) $$ = jquery; this.canvas = document.getElementById('snow'); this.stageWidth = window.innerWidth; this.stageHeight = window.innerHeight; this.w = this.stageWidth; this.h = this.stageHeight; this.tick = 0; this.timeStep = 1 / 60; this.time = 0; this.renderer = PIXI.autoDetectRenderer(this.stageWidth, this.stageHeight, { view : this.canvas, transparent : true }); this.renderer.view.style.position = "absolute"; this.renderer.view.style.top = "0px"; this.renderer.view.style.left = "0px"; this.renderer.view.style.bottom = "0px"; this.stage = new PIXI.Stage(); this.container = new PIXI.DisplayObjectContainer(); this.particleLayer = new PIXI.DisplayObjectContainer(); this.device = new Device(); this.particleManager = new ParticleManager(this); this.particleManager.registerParticle(Snow, 1); this.container.addChild(this.particleLayer); this.stage.addChild(this.container); var that = this; }; App.constructor = App; App.prototype.init = function() { var i = 0; this.particleManager.addParticle(Math2.randomInt(-50, this.stageWidth), -50, 1); // Needed to trigger resizeCanvas after wheel.ready to get acurate initial stage height -mm var app = this; requestAnimFrame( this.update.bind(this) ); }; App.prototype.resizeCanvas = function() { this.stageWidth = window.innerWidth; this.stageHeight = window.innerHeight; if(!this.renderer) return; this.renderer.resize(this.stageWidth, this.stageHeight); }; App.prototype.update = function() { this.tick++; this.particleManager.update(); var i = 0; this.renderer.render(this.stage); requestAnimFrame(this.update.bind(this)); this.renderer.render(this.stage); }; var Device = function() { this.arora = false; this.chrome = false; this.epiphany = false; this.firefox = false; this.mobileSafari = false; this.androidBrowser = false; this.ie = false; this.ieVersion = 0; this.midori = false; this.opera = false; this.safari = false; this.webApp = false; this.cocoonJS = false; this.android = false; this.chromeOS = false; this.iOS = false; this.linux = false; this.macOS = false; this.windows = false; this.desktop = false; this.pixelRatio = 0; this.iPhone = false; this.iPhone4 = false; this.iPad = false; this.blob = false; this.canvas = false; this.localStorage = false; this.file = false; this.fileSystem = false; this.webGL = false; this.worker = false; this.audioData = false; this.webAudio = false; this.ogg = false; this.opus = false; this.mp3 = false; this.wav = false; this.m4a = false; this.webm = false; var ua = navigator.userAgent; this._checkBrowser(ua); this._checkOS(ua); this._checkDevice(ua); this._checkAudio(); this._checkFeatures(); this._checkIsMobile(); }; Device.prototype._checkBrowser = function(ua) { if (/Arora/.test(ua)) { this.arora = true; } else if (/Chrome/.test(ua)) { this.chrome = true; } else if (/Epiphany/.test(ua)) { this.epiphany = true; } else if (/Firefox/.test(ua)) { this.firefox = true; } else if (/Mobile Safari/.test(ua)) { this.mobileSafari = true; } else if (/MSIE (\d+\.\d+);/.test(ua) || !!navigator.userAgent.match(/Trident.*rv[ :]*11\./)) { this.ie = true; this.ieVersion = parseInt(RegExp.$1, 10); } else if (/Midori/.test(ua)) { this.midori = true; } else if (/Opera/.test(ua)) { this.opera = true; } else if (/Safari/.test(ua)) { this.safari = true; } this.androidBrowser = this.android === true && this.chrome === false; // Native Application if (navigator.standalone) { this.webApp = true; } // CocoonJS Application if (navigator.isCocoonJS) { this.cocoonJS = true; } }; Device.prototype._checkOS = function(ua) { if (/Android/.test(ua)) { this.android = true; } else if (/CrOS/.test(ua)) { this.chromeOS = true; } else if (/iP[ao]d|iPhone/i.test(ua)) { this.iOS = true; this.iOS_version = parseFloat( ('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,''])[1]) .replace('undefined', '3_2').replace('_', '.').replace('_', '') ) || false; } else if (/Linux/.test(ua)) { this.linux = true; } else if (/Mac OS/.test(ua)) { this.macOS = true; } else if (/Windows/.test(ua)) { this.windows = true; } if (this.windows || this.macOS || this.linux) { this.desktop = true; } }; Device.prototype._checkDevice = function() { this.pixelRatio = window.devicePixelRatio || 1; this.iPhone = navigator.userAgent.toLowerCase().indexOf('iphone') !== -1; this.iPhone4 = (this.pixelRatio === 2 && this.iPhone); this.iPad = navigator.userAgent.toLowerCase().indexOf('ipad') !== -1; }; Device.prototype._checkFeatures = function() { if (typeof window.Blob !== 'undefined') this.blob = true; this.canvas = !!window.CanvasRenderingContext2D; try { this.localStorage = !!localStorage.getItem; } catch (error) { this.localStorage = false; } this.file = !!window.File && !!window.FileReader && !!window.FileList && !!window.Blob; this.fileSystem = !!window.requestFileSystem; this.webGL = ( function () { try { var canvas = document.createElement( 'canvas' ); return !! window.WebGLRenderingContext && ( canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) ); } catch( e ) { return false; } } )(); if(this.android || this.ie) this.webGL = false; this.worker = !!window.Worker; if ('ontouchstart' in document.documentElement || window.navigator.msPointerEnabled) { this.touch = true; } }; Device.prototype._checkAudio = function() { this.audioData = !!(window.Audio); this.webaudio = !!(window.webkitAudioContext || window.AudioContext); var audioElement = document.createElement('audio'); var result = false; try { if (!!audioElement.canPlayType) { if (audioElement.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, '')) { this.ogg = true; } if (audioElement.canPlayType('audio/mpeg;').replace(/^no$/, '')) { this.mp3 = true; } // Mimetypes accepted: // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements // bit.ly/iphoneoscodecs if (audioElement.canPlayType('audio/wav; codecs="1"').replace(/^no$/, '')) { this.wav = true; } if (audioElement.canPlayType('audio/x-m4a;') || audioElement.canPlayType('audio/aac;').replace(/^no$/, '')) { this.m4a = true; } } } catch (e) { } }; Device.prototype._checkIsMobile = function() { var check = false; (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera); this.isMobile = check; }; Device.prototype.getInfo = function() { var output = "DEVICE OUTPUT\n\n"; output += "---\n"; output += "Browser Info :: \n"; output += "Arora : " + this.arora + "\n"; output += "Chrome : " + this.chrome + "\n"; output += "Epiphany : " + this.epiphany + "\n"; output += "Firefox : " + this.firefox + "\n"; output += "Mobile Safari : " + this.mobileSafari + "\n"; output += "IE : " + this.ie; if(this.ie) { output += " (Version " + this.ieVersion + ")\n"; } else { output += "\n"; } output += "Midori : " + this.midori + "\n"; output += "Opera : " + this.opera + "\n"; output += "Safari : " + this.safari + "\n"; output += "Web App : " + this.webApp + "\n"; output += "CocoonJS : " + this.cocoonJS + "\n"; output += "Android : " + this.android + "\n"; output += "---\n"; output += "Operating System :: \n"; output += "Chrome OS : " + this.chromeOS + "\n"; output += "iOS : " + this.iOS + "\n"; output += "Linux : " + this.linux + "\n"; output += "Mac OS : " + this.macOS + "\n"; output += "Windows : " + this.windows + "\n"; output += "Desktop : " + this.desktop + "\n"; output += "---\n"; output += "Device Type : \n"; output += "Pixel Ratio : " + this.pixelRatio + "\n"; output += "iPhone : " + this.iPhone + "\n"; output += "iPhone 4 : " + this.iPhone4 + "\n"; output += "iPad : " + this.iPad + "\n"; output += "---\n"; output += "Features :: \n"; output += "Blob : " + this.blob + "\n"; output += "Canvas : " + this.canvas + "\n"; output += "LocalStorage : " + this.localStorage + "\n"; output += "File : " + this.file + "\n"; output += "File System : " + this.fileSystem + "\n"; output += "WebGL : " + this.webGL + "\n"; output += "Workers : " + this.worker + "\n"; output += "---\n"; output += "Audio :: \n"; output += "AudioData : " + this.audioData + "\n"; output += "WebAudio : " + this.webAudio + "\n"; output += "Supports .ogg : " + this.ogg + "\n"; output += "Supports Opus : " + this.opus + "\n"; output += "Supports .mp3 : " + this.mp3 + "\n"; output += "Supports .wav : " + this.wav + "\n"; output += "Supports .m4a : " + this.m4a + "\n"; output += "Supports .webm : " + this.webm; return output; }; GameObjectPool = function(classType) { this.classType = classType; this.pool = []; }; GameObjectPool.constructor = GameObjectPool; GameObjectPool.prototype.getObject = function() { var object = this.pool.pop(); if(!object) { object = new this.classType(); } return object; }; GameObjectPool.prototype.returnObject = function(object) { this.pool.push(object); }; GameObjectPool.pools = []; GameObjectPool.idGenerator = 1; GameObjectPool.getObject = function(classType) { if(!classType._CLASS_ID) { classType._CLASS_ID = GameObjectPool.idGenerator++; GameObjectPool.pools[classType._CLASS_ID] = new GameObjectPool(classType); } var object = GameObjectPool.pools[classType._CLASS_ID].getObject(); object._CLASS_ID = classType._CLASS_ID; return object; }; GameObjectPool.returnObject = function(object) { GameObjectPool.pools[object._CLASS_ID].returnObject(object); }; var Math2 = { }; Math2.random = function(from, to) { from = from || 0; to = to === undefined ? 1 : to; return from + Math.random() * (to-from); }; Math2.randomInt = function(from, to) { return (from + Math.random() * (to-from)) | 0; }; // in order to work 'Math.seed' must NOT be undefined, // so in any case, you HAVE to provide a Math.seed Math2.randomSeed = function(from, to, seed) { min = from; max = to; seed = seed || 1; seed = (seed * 9301 + 49297) % 233280; var rnd = seed / 233280; return min + rnd * (max - min); }; Math2.randomChance = function(chance, seed) { return Math2.randomSeed(0, 1, seed) > chance; }; Math2.smallestAngle = function(angle, targetAngle) { // STANDARD var difference1 = targetAngle - angle; // "ROUND THE HORN" CLOCKWISE / POSITIVE var difference2 = (targetAngle + (Math.PI * 2)) - angle; // "ROUND THE HORN" ANTI-CLOCKWISE / NEGATIVE var difference3 = (targetAngle - (Math.PI * 2)) - angle; // GET SHORTEST var absDifference1 = Math.abs(difference1); var absDifference2 = Math.abs(difference2); var absDifference3 = Math.abs(difference3); var difference = difference1; if (absDifference2 < absDifference1 && absDifference2 < absDifference3) { difference = difference2; } else if (absDifference3 < absDifference1 && absDifference3 < absDifference2) { difference = difference3; } return difference; }; Math2.map = function(value, low1, high1, low2, high2) { var ratio = (value - low1) / (high1 - low1); return low2 + (high2-low2) * ratio; }; var ParticleManager = function(game) { this.game = game; this.pools = []; this.activeParticles = []; }; ParticleManager.prototype.registerParticle = function(ParticleClass, id) { ParticleClass.prototype._particleId = id; this.pools[id] = new GameObjectPool(ParticleClass); }; ParticleManager.prototype.addParticle = function(x, y, id) { var particle = this.pools[id].getObject(); if(arguments.length > 3) { var args = new Array(arguments.length); args[0] = x; args[1] = y; for(var i = 3; i < args.length; ++i) { args[i-1] = arguments[i]; } particle.activate.apply(particle, args); } else { particle.activate(x, y); } this.game.particleLayer.addChild(particle); this.activeParticles.push(particle); }; ParticleManager.prototype.update = function() { for (var i = 0; i < this.activeParticles.length; i++) { var particle = this.activeParticles[i]; particle.update(); if(particle.isDead) { this.activeParticles.splice(i, 1); i--; this.game.particleLayer.removeChild(particle); this.pools[particle._particleId].returnObject(particle); } } }; var Snow = function() { PIXI.DisplayObjectContainer.call(this); this.particles = []; this.wind = 0; if (Modernizr.isios == true) { this.total = 0; // trying to help performance on iOS - mm } else { this.total = 20; } for (var i = 0; i < this.total; i++) { var x = Math2.randomInt(1, window.innerWidth); var y = Math2.randomInt(-50, window.innerHeight); var sprite = new SnowFlake(); sprite.reset(x, y); this.addChild(sprite); this.particles.push(sprite); } }; Snow.prototype = Object.create( PIXI.DisplayObjectContainer.prototype ); Snow.prototype.activate = function(x, y) { }; Snow.prototype.update = function() { for (var i=0; i < this.total; i++) { var particle = this.particles[i]; if(particle.velY <= particle.speed) { particle.velY = particle.speed; } particle.step += 1; var xMove = Math.cos((particle.step)/particle.shift) * particle.amp + particle.drift + this.wind; particle.position.x += xMove; particle.position.y += particle.velY; if(particle.position.y > window.innerHeight) this.resetParticle('bottom', particle); if(particle.position.x > window.innerWidth + 30) this.resetParticle('right', particle); if(particle.position.x < -30) this.resetParticle('left', particle); } }; Snow.prototype.resetParticle = function(direction, particle) { var x = 0; var y = 0; switch(direction) { case 'bottom': x = Math.floor(Math.random() * window.innerWidth); y = -20; break; case 'right': x = -10; y = Math.floor(Math.random() * window.innerHeight); break; case 'left': x = window.innerWidth + 10; y = Math.floor(Math.random() * window.innerHeight); break; } particle.reset(x, y); }; var SnowFlake = function() { var texture = PIXI.Texture.fromImage('/holiday/2015/images/snowflakeThree.png'); PIXI.Sprite.call(this, texture); this.anchor.x = 0.5; this.anchor.y = 0.5; }; SnowFlake.prototype = Object.create( PIXI.Sprite.prototype ); SnowFlake.prototype.reset = function(x, y) { this.position.x = x; this.position.y = y; this.scale.x = this.scale.y = (Math.random() * 0.5) + 0.05; this.speed = (Math.random() * 1) + 0.5; //this.alpha = (Math.random() * 0.5) + 0.3; this.alpha = 1; // made solid -mm this.step = 0; this.velY = this.speed; this.velX = 0; this.amp = Math.random() * 2; this.shift = Math.random() * 25 + 25; this.drift = Math.random() - 0.5; if (Math.random() > 0.5) this.shift *= -1; }; // create an array of assets to load var assetsToLoader = [ "/holiday/2015/images/ugga/UggaMugga_frame_0.png", "/holiday/2015/images/ugga/UggaMugga_frame_1.png", "/holiday/2015/images/ugga/UggaMugga_frame_2.png", "/holiday/2015/images/ugga/UggaMugga_frame_3.png", "/holiday/2015/images/ugga/UggaMugga_frame_4.png", "/holiday/2015/images/ugga/UggaMugga_frame_5.png", "/holiday/2015/images/ugga/UggaMugga_frame_6.png", "/holiday/2015/images/ugga/UggaMugga_frame_7.png", "/holiday/2015/images/ugga/UggaMugga_frame_8.png", "/holiday/2015/images/ugga/UggaMugga_frame_9.png", "/holiday/2015/images/ugga/UggaMugga_frame_10.png", "/holiday/2015/images/ugga/UggaMugga_frame_11.png", "/holiday/2015/images/ugga/UggaMugga_frame_12.png", "/holiday/2015/images/ugga/UggaMugga_frame_13.png", "/holiday/2015/images/ugga/UggaMugga_frame_14.png", "/holiday/2015/images/ugga/UggaMugga_frame_15.png", "/holiday/2015/images/ugga/UggaMugga_frame_16.png", "/holiday/2015/images/ugga/UggaMugga_frame_17.png", "/holiday/2015/images/ugga/UggaMugga_frame_18.png", "/holiday/2015/images/ugga/UggaMugga_frame_19.png", "/holiday/2015/images/ugga/UggaMugga_frame_20.png", "/holiday/2015/images/ugga/UggaMugga_frame_21.png", "/holiday/2015/images/ugga/UggaMugga_frame_22.png", "/holiday/2015/images/ugga/UggaMugga_frame_23.png", "/holiday/2015/images/ugga/UggaMugga_frame_24.png", "/holiday/2015/images/ugga/UggaMugga_frame_25.png", "/holiday/2015/images/ugga/UggaMugga_frame_26.png", "/holiday/2015/images/ugga/UggaMugga_frame_27.png", "/holiday/2015/images/ugga/UggaMugga_frame_28.png", "/holiday/2015/images/ugga/UggaMugga_frame_29.png", "/holiday/2015/images/ugga/UggaMugga_frame_30.png", "/holiday/2015/images/ugga/UggaMugga_frame_31.png", "/holiday/2015/images/ugga/UggaMugga_frame_32.png", "/holiday/2015/images/ugga/UggaMugga_frame_33.png", "/holiday/2015/images/ugga/UggaMugga_frame_34.png", "/holiday/2015/images/ugga/UggaMugga_frame_35.png", "/holiday/2015/images/ugga/UggaMugga_frame_36.png", "/holiday/2015/images/ugga/UggaMugga_frame_37.png", "/holiday/2015/images/ugga/UggaMugga_frame_38.png", "/holiday/2015/images/ugga/UggaMugga_frame_39.png", "/holiday/2015/images/ugga/UggaMugga_frame_40.png", "/holiday/2015/images/ugga/UggaMugga_frame_41.png", "/holiday/2015/images/ugga/UggaMugga_frame_42.png", "/holiday/2015/images/ugga/UggaMugga_frame_43.png", "/holiday/2015/images/ugga/UggaMugga_frame_44.png", "/holiday/2015/images/ugga/UggaMugga_frame_45.png", "/holiday/2015/images/ugga/UggaMugga_frame_46.png", "/holiday/2015/images/ugga/UggaMugga_frame_47.png", "/holiday/2015/images/ugga/UggaMugga_frame_48.png", "/holiday/2015/images/ugga/UggaMugga_frame_49.png", "/holiday/2015/images/ugga/UggaMugga_frame_50.png", "/holiday/2015/images/ugga/UggaMugga_frame_51.png", "/holiday/2015/images/ugga/UggaMugga_frame_52.png", "/holiday/2015/images/ugga/UggaMugga_frame_53.png", "/holiday/2015/images/ugga/UggaMugga_frame_54.png", "/holiday/2015/images/ugga/UggaMugga_frame_55.png", "/holiday/2015/images/ugga/UggaMugga_frame_56.png", "/holiday/2015/images/ugga/UggaMugga_frame_57.png", "/holiday/2015/images/ugga/UggaMugga_frame_58.png", "/holiday/2015/images/ugga/UggaMugga_frame_59.png", "/holiday/2015/images/ugga/UggaMugga_frame_60.png", "/holiday/2015/images/ugga/UggaMugga_frame_61.png", "/holiday/2015/images/ugga/UggaMugga_frame_62.png", "/holiday/2015/images/ugga/UggaMugga_frame_63.png", "/holiday/2015/images/ugga/UggaMugga_frame_64.png", "/holiday/2015/images/ugga/UggaMugga_frame_65.png", "/holiday/2015/images/ugga/UggaMugga_frame_66.png", "/holiday/2015/images/ugga/UggaMugga_frame_67.png", "/holiday/2015/images/ugga/UggaMugga_frame_68.png", "/holiday/2015/images/ugga/UggaMugga_frame_69.png", "/holiday/2015/images/ugga/UggaMugga_frame_70.png", "/holiday/2015/images/ugga/UggaMugga_frame_71.png", "/holiday/2015/images/ugga/UggaMugga_frame_72.png", "/holiday/2015/images/ugga/UggaMugga_frame_73.png", "/holiday/2015/images/ugga/UggaMugga_frame_74.png", "/holiday/2015/images/ugga/UggaMugga_frame_75.png", "/holiday/2015/images/ugga/UggaMugga_frame_76.png", "/holiday/2015/images/ugga/UggaMugga_frame_77.png", "/holiday/2015/images/ugga/UggaMugga_frame_78.png", "/holiday/2015/images/ugga/UggaMugga_frame_79.png", "/holiday/2015/images/ugga/UggaMugga_frame_80.png", "/holiday/2015/images/ugga/UggaMugga_frame_81.png", "/holiday/2015/images/ugga/UggaMugga_frame_82.png", "/holiday/2015/images/ugga/UggaMugga_frame_83.png", "/holiday/2015/images/ugga/UggaMugga_frame_84.png", "/holiday/2015/images/ugga/UggaMugga_frame_85.png", "/holiday/2015/images/ugga/UggaMugga_frame_86.png", "/holiday/2015/images/ugga/UggaMugga_frame_87.png", "/holiday/2015/images/ugga/UggaMugga_frame_88.png", "/holiday/2015/images/ugga/UggaMugga_frame_89.png", "/holiday/2015/images/ugga/UggaMugga_frame_90.png", "/holiday/2015/images/ugga/UggaMugga_frame_91.png", "/holiday/2015/images/ugga/UggaMugga_frame_92.png", "/holiday/2015/images/ugga/UggaMugga_frame_93.png" ]; // create a new loader loader = new PIXI.AssetLoader(assetsToLoader); // use callback loader.onComplete = onAssetsLoaded; //begin load loader.load(); var daniel_textures = []; function onAssetsLoaded() { for (var i=0; i < 93; i++) { var texture = PIXI.Texture.fromFrame(assetsToLoader[i]); daniel_textures.push(texture); }; //makeDaniel(); $(document).trigger('daniel.ready'); }; var makeDaniel = function() { var danielSprite = new PIXI.MovieClip(daniel_textures); $(document).trigger('daniel.ready'); danielSprite.gotoAndPlay(0); }; // Avoid `console` errors in browsers that lack a console. (function() { var method; var noop = function () {}; var methods = [ 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn' ]; var length = methods.length; var console = (window.console = window.console || {}); while (length--) { method = methods[length]; // Only stub undefined methods. if (!console[method]) { console[method] = noop; } } }()); // Place any jQuery/helper plugins in here. ; Object.defineProperty(Object.prototype, "extendify", { enumerable: false, value: function(from) { var props = Object.getOwnPropertyNames(from); var dest = this; props.forEach(function(name) { if (name in dest) { var destination = Object.getOwnPropertyDescriptor(from, name); Object.defineProperty(dest, name, destination); } }); return this; } });