Created
October 20, 2011 10:17
-
-
Save NicolaiSattler/1300827 to your computer and use it in GitHub Desktop.
trail
This file contains hidden or 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
| package | |
| { | |
| import flash.display.Sprite; | |
| import flash.events.Event; | |
| import flash.events.TimerEvent; | |
| import flash.utils.Timer; | |
| public class LineTrail extends Sprite | |
| { | |
| public var _timer:Timer; | |
| public var _counter:uint; | |
| public var _spawnPos:Array = new Array(); | |
| public function LineTrail() | |
| { | |
| addEventListener(Event.ADDED_TO_STAGE,init); | |
| } | |
| public function init(e:Event):void | |
| { | |
| removeEventListener(Event.ADDED_TO_STAGE, init) | |
| _timer = new Timer(16); | |
| _timer.addEventListener(TimerEvent.TIMER, spawn); | |
| _timer.start(); | |
| } | |
| public function spawn(te:TimerEvent):void | |
| { | |
| _counter+=1; | |
| _spawnPos['x']= (Math.sin(_counter/55)*300+200)+(Math.cos(_counter/10)*150+200); | |
| _spawnPos['y']= (Math.cos(_counter/44)*200+150)+(Math.sin(_counter/11)/100+150); | |
| _spawnPos['z']= (Math.cos(_counter/100)*200+150)+(Math.sin(_counter/500)/100+150); | |
| var pt:Line = new Line(); | |
| pt._effectList2.push(new GravityEffectTrail(1)); | |
| pt._effectList2.push(new FadeEffectTrail()); | |
| pt.x = _spawnPos['x']; | |
| pt.y = _spawnPos['y']; | |
| pt.z = _spawnPos['z']; | |
| addChild(pt); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment