etRandomPosition:function(a,b,c,d){360*Math.random()*Math.PI/180;return{x:Math.floor(Math.random()*c+a),y:Math.fl oor(Math.random()*d+b)}}},StarField=function(a){return this.container=document.getElementById(a),this.canvasElem= this.container.getElementsByTagName("canvas")[0],this.canvas=this.canvasElem.getContext("2d"),this.width=this.con tainer.offsetWidth,this.height=this.container.offsetHeight,this.starField=[],this};StarField.prototype._updateSta rField=function(){var a,b,c,d;for(a=0;a<this.numStars;a++)b=this.starField[a],d=Math.min(b.speed,Math.abs(b.speed /b.slope)),b.x+=b.x>0?d:-d,b.y=b.slope*b.x,b.opacity+=b.speed/100,(Math.abs(b.x)>this.width/2||Math.abs(b.y)>this .height/2)&&(c=BigBang.getRandomPosition(-this.width/10,-this.height/10,this.width/5,this.height/5))},StarField.p rototype._renderStarField=function(){var a,b;this.canvas.fillStyle="rgba(0, 0, 0, .5)",this.canvas.fillRect(0,0,t his.width,this.height);this.numStars/10|0;for(this.canvas.beginPath(),a=0;a<this.numStars;a++)b=this.starField[a] ,this.canvas.rect(b.x+this.width/2,b.y+this.height/2,2,2);this.canvas.closePath(),this.canvas.fillStyle="rgba(200 , 200, 200, 0.4)",this.canvas.fill()},StarField.prototype._renderFrame=function(a){var b=a-(this.prevFrameTime||0 );window.raf(this._renderFrame.bind(this)),(b>=30||!this.prevFrameTime)&&(this.prevFrameTime=a,this._updateStarFi eld(),this._renderStarField())},StarField.prototype._adjustCanvasSize=function(a,b){this.width=this.canvasElem.wi dth=a||this.container.offsetWidth,this.height=this.canvasElem.height=b||this.container.offsetHeight},StarField.pr ototype._watchCanvasSize=function(a){var c,d,b=a-(this.prevCheckTime||0);(b>=333||!this.prevCheckTime)&&(this.pre vCheckTime=a,c=this.container.offsetWidth,d=this.container.offsetHeight,(this.oldWidth!==c||this.oldHeight!==d)&& (this.oldWidth=c,this.oldHeight=d,this._adjustCanvasSize(c,d)))},StarField.prototype._initScene=function(a){var b ;for(b=0;b<this.numStars;b++)this.starField.push(BigBang.getRandomStar(-this.width/2,-this.height/2,this.width,th is.height,this.maxStarSpeed));window.raf(this._renderFrame.bind(this)),window.raf(this._watchCanvasSize.bind(this ))},StarField.prototype.render=function(a,b){this.numStars=a||100,this.maxStarSpeed=b||3,this._initScene(this.num Stars)};var stars=new StarField("fullScreen");stars.render(256,20),setTimeout(function(){var a=function(){var b=s tars.maxStarSpeed*=.8,c=0,d=stars.starField.length;if(b>.05){for(;d>c;c++)stars.starField[c].speed=Math.max(Math. random()*b,absoluteMaxSpeed);window.raf(a)}};a()},750); // http://2015.ffconf.org/js/starfield.js