Zyles
Posts : 388 Experience : 1657 Join date : 2009-05-24 Location : Sailing the seven seas Country :
| Subject: Help pwease. Mon Jun 01, 2009 10:30 pm | |
| Does anyone know an Actionscript II trail effect. Or could someone convert this one: - Code:
-
//Set timer so trail will be draw at every frame var timer:Timer = new Timer(10,400000); timer.addEventListener (TimerEvent.TIMER, createTrail); timer.start ();
/*PrevTopX - x of the top marker on previous frame PrevTopY - y of the top marker on previous frame PrevBottomX - x of the bottom marker on previous frame PrevBottomY - y of the bottom marker on previous frame */
var PrevTopX:Number=topmarker.x; var PrevTopY:Number=topmarker.y; var PrevBottomX:Number=bottommarker.x; var PrevBottomY:Number=bottommarker.y;
function createTrail (e:Event):void { var trail:MovieClip = new MovieClip (); //You can change your color here trail.graphics.beginFill (0x0033CC); //Basically, I draw a 4-end polygon connect the 4 markers trail.graphics.moveTo (topmarker.x, topmarker.y); trail.graphics.lineTo (PrevTopX, PrevTopY); trail.graphics.lineTo (PrevBottomX, PrevBottomY); trail.graphics.lineTo (bottommarker.x, bottommarker.y); trail.graphics.lineTo (topmarker.x, topmarker.y); trail.graphics.endFill (); trail.addEventListener (Event.ENTER_FRAME, animateTrail); addChildAt (trail, 0); //If you use addChild here, the trail will be created on top of the blade //Since you don't want that, addChildAt will add new clip on level 0 which is the bottom
PrevTopX=topmarker.x; PrevTopY=topmarker.y; PrevBottomX=bottommarker.x; PrevBottomY=bottommarker.y; }
function animateTrail (e:Event):void { //Reduce the alpha of the trail in each frame by 20% //Reduce this number for longer trail. e.target.alpha -= 0.20; //Remove the trail when alpha is smaller than 0 if (e.target.alpha < 0) { e.target.removeEventListener (Event.ENTER_FRAME,animateTrail); removeChild ((MovieClip)(e.target)); } } | |
|
Kieran. V.I.P
Posts : 1233 Experience : 2147483647 Join date : 2009-05-10 Age : 29 Location : England Country :
| Subject: Re: Help pwease. Mon Jun 01, 2009 10:31 pm | |
| | |
|
Fizz Moderator
Posts : 1023 Experience : 5970 Join date : 2009-03-25 Age : 29 Location : London Country :
| Subject: Re: Help pwease. Mon Jun 01, 2009 10:49 pm | |
| holy SHIT. actually, on FI (flashindustries) there's one. (it's back up again) | |
|
Reaven Admin
Posts : 676 Experience : 10001287 Join date : 2008-12-17 Age : 30 Location : im your neighbor!!!.....naah, im German. Country :
| Subject: Re: Help pwease. Mon Jun 01, 2009 10:52 pm | |
| this is the script from FI create a mc. in this mc put this code to the first frame: - Code:
-
function onEnterFrame() { sword.onEnterFrameFunc(); } sword.alpha = 50; sword.rgb = 25000; sword.lineMC._visible = false; sword.queueLen = 5;
then,on a new layer but still the first frame create a hairline, convert it into a mc and give it the instand name "sword". now doubleclick the sword mc...on the first frame add this: - Code:
-
function getPosNow() { var _loc2 = {x: 0, y: 0}; var _loc1 = {x: 0, y: 0}; localToGlobal(_loc2); lineMC.localToGlobal(_loc1); return ({p1: _loc2, p2: _loc1}); } if (rgb == null) { rgb = 16777215; } if (alpha == null) { alpha = 100; } createEmptyMovieClip("shadowMC", 0); if (shadowMC.shaQueue == null) { shadowMC.shaQueue = new Array(); shadowMC.queueLen = Math.abs(int(queueLen)); if (shadowMC.queueLen == 0) { shadowMC.queueLen = 10; } var p = getPosNow(); var i = 0; while (i < shadowMC.queueLen) { shadowMC.shaQueue.push(p); ++i; } } onEnterFrameFunc = function () { shadowMC.pushPos(); shadowMC.render(); }; shadowMC.pushPos = function () { this.shaQueue.shift(); this.shaQueue.push(getPosNow()); }; shadowMC.render = function () { this.clear(); var _loc10 = alpha; var _loc13 = _loc10 / this.queueLen; var _loc3 = []; for (var _loc2 in this.shaQueue) { var _loc5 = this.shaQueue[_loc2].p1; var _loc8 = this.shaQueue[_loc2].p2; var _loc6 = {x: _loc5.x, y: _loc5.y}; var _loc9 = {x: _loc8.x, y: _loc8.y}; this.globalToLocal(_loc6); this.globalToLocal(_loc9); _loc3[_loc2] = {p1: _loc6, p2: _loc9}; } for (var _loc2 = _loc3.length - 1; _loc2 > 0; --_loc2) { _loc5 = _loc3[_loc2].p1; _loc8 = _loc3[_loc2].p2; var _loc4 = _loc3[_loc2 - 1].p2; var _loc7 = _loc3[_loc2 - 1].p1; this.beginFill(rgb, _loc10); this.moveTo(_loc5.x, _loc5.y); this.lineTo(_loc8.x, _loc8.y); this.lineTo(_loc4.x, _loc4.y); this.endFill(); this.beginFill(rgb, _loc10); this.moveTo(_loc4.x, _loc4.y); this.lineTo(_loc7.x, _loc7.y); this.lineTo(_loc5.x, _loc5.y); this.endFill(); _loc10 = _loc10 - _loc13; } };
in the mc there should be the line you just created.....select it, turn it into a mc and give it the instand name "lineMC". hope it works | |
|
Zyles
Posts : 388 Experience : 1657 Join date : 2009-05-24 Location : Sailing the seven seas Country :
| Subject: Re: Help pwease. Mon Jun 01, 2009 10:52 pm | |
| | |
|
Fizz Moderator
Posts : 1023 Experience : 5970 Join date : 2009-03-25 Age : 29 Location : London Country :
| Subject: Re: Help pwease. Mon Jun 01, 2009 10:55 pm | |
| holy f*ck :D now zyles' got 2 lovers | |
|
Zyles
Posts : 388 Experience : 1657 Join date : 2009-05-24 Location : Sailing the seven seas Country :
| Subject: Re: Help pwease. Tue Jun 02, 2009 4:11 pm | |
| Wait, I've got the trail, but the trail only comes from the top of the corner of the hammer, how do I get it so the trail comes from the whole hammer? | |
|
Sponsored content
| Subject: Re: Help pwease. | |
| |
|