var EHDI = EHDI || Object.create(nul); EHDI.components = EHDI.components || Object.create(null); EHDI.components.BeamParticle = function() { //PIXI.particles.ParticleContainer.call(this); EHDI.aka.Container.call(this); //this.animationTimeline = new TimelineMax(); this.interactive=false; //this.visible = false; // this.addChild(containerSprite); var thingy = this; var thing = 1+Math.floor(Math.random()*2); this.beam = new EHDI.aka.Sprite(EHDI.Assets.images["title_tt_spdline"+thing]); this.beam.anchor.x = 0.5; this.beam.anchor.y = 0.5; this.addChild(this.beam); this.angle = Math.random()*Math.PI*2; this.beam.rotation = this.angle; this.speed = 2+Math.random()*2; var distence = Math.sqrt(Math.pow(EHDI.GAME.sceneManager.getStageWidth() ,2),Math.pow(EHDI.GAME.sceneManager.getStageHeight() ,2)); this.targetX = (distence * Math.cos(this.angle)); this.targetY = (distence * Math.sin(this.angle)); this.animationTimeline = new TimelineMax(); this.animationTimeline.to(this.beam,this.speed,{x:this.targetX,y:this.targetY,onComplete:function() {thingy.destroy();}}); //this.starUpdate = this.updateTime.bind(this); // EHDI.GAME.updateManager.addFrameListener(this.starUpdate); }; EHDI.components.BeamParticle.prototype = Object.create(EHDI.aka.Container.prototype); EHDI.components.BeamParticle.prototype.destroy = function() { this.animationTimeline.kill(); EHDI.aka.Container.prototype.destroy.apply(this, arguments); } EHDI.components.BeamParticle.prototype.stopAllAnimations = function() { this.animationTimeline.kill(); this.animationTimeline.clear(); this.alpha=0; } EHDI.components.BeamParticle.prototype.updateTime = function(dt) { if(this.visible===false) return; };