dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Help With Ghostly Light Tails/Trails

  1. #1
    The New Guy
    Join Date
    Nov 2007
    Posts
    67

    Help With Ghostly Light Tails/Trails

    Hi everyone.

    I'm wanting to create an effect in AS3 where a light source would leave a short smooth ghostly tail as it moves around. (Just imagine a bright LED moving around in a dark room). The effect would fade and shrink towards the end of the tail (like a comet's tail only a lot more fluid).

    Anyone have any ideas? Any help is appreciated.

    Thanks!

  2. #2
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    its as2 but you should be able to convert it
    Code:
    speed = 1;
    trail=20;
    for (var i = 0; i<trail; i++) {
            mc = _root.createEmptyMovieClip("p"+i, i);
            if (i) {
                    mc.prevClip = _root["p"+(i-1)];
                    mc.onEnterFrame = function() {
                            this._x += (this.prevClip._x-this._x)/speed;
                            this._y += (this.prevClip._y-this._y)/speed;
                    }
            } else {
                    mc.onEnterFrame = function() {
                            this._x += (_root._xmouse-this._x)/speed;
                            this._y += (_root._ymouse-this._y)/speed;
                    }
            }
    }
    this.createEmptyMovieClip("draw",1000);
    this.onEnterFrame=function()
    {
    	draw.clear();
    	draw.lineStyle(3,0x000000,100);
    	mc="p0";
    	draw.moveTo(this[mc]._x,this[mc]._y);
    	for(i=1;i<trail;i++)
    	{
    		draw.lineStyle((i*-0.5)+10,0xFF0000,100);
    		mc="p"+i;
    		draw.lineTo(this[mc]._x,this[mc]._y);
    	}
    }

  3. #3
    FK founder & general loiterer Flashkit's Avatar
    Join Date
    Feb 2000
    Location
    Sydney
    Posts
    1,149
    use a bitmapdata object and either use copypixels or draw to draw onto it.
    Then you can apply a blur to the bitmapdata object and this will create your trails.
    Regards Mark Fennell - Flash Kit Founder, general loiterer
    -------------------------------
    I Hate Zombies - iPhone Game | markfennell.com

  4. #4
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    Yep or use ColourMatrixFilter.

    I've got an example in my sig ( Dot vectors ).

    Squize.

  5. #5

  6. #6
    The New Guy
    Join Date
    Nov 2007
    Posts
    67
    Thanks for the help guys!! I appreciate it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center