As 3.0 Line Effect
January 13th, 2009 Posted in ActionScript 3.0
Hi everyone and welcome again to my blog. Well, this is a very simply effect applied to a line. This is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | /** * Author: Horatiu Condrea ( http://www.flashdesign-store.com ) * Description: AS 3.0 Line Effect **/ // ------------------------------------- // Variables // ------------------------------------- // I created these 2 variables(bmd and bm) // Because the filter must know where to act // If you whant a full effect, the stage size must be equal in the script var bmd:BitmapData = new BitmapData(550, 400 , true, 0X000000); var bm:Bitmap = new Bitmap(bmd); addChild(bm); var sp:Sprite = new Sprite(); addChild(sp); var bf:BlurFilter = new BlurFilter(3,3,3); // Set the BlurFilter Effect var cmf:ColorMatrixFilter = new ColorMatrixFilter // Set the ColorMatrixFilter Effect ([1, 2, 1, 5, 1, 0, 1, 2, 2, 3, 2, 0, 2, 2, 0, 0, 0, 0, 0.83, 0]); // ------------------------------------- // Methods // ------------------------------------- stage.addEventListener (MouseEvent.MOUSE_MOVE, curveLine); // Now, add an ENTER_FRAME event listener that // will allow to add the filter addEventListener(Event.ENTER_FRAME, loop); function curveLine(event:MouseEvent):void { // Set the line settings sp.graphics.clear(); sp.graphics.lineStyle(1.5, 0xffffff); sp.graphics.moveTo(mouseX, mouseY); sp.graphics.curveTo(stage.stageWidth / 2, stage.stageHeight / 2, stage.stageWidth / 2, 0); } function loop(e:Event):void { // Apply the filter effects to line bmd.draw(sp); bmd.applyFilter(bmd, bmd.rect,new Point(),bf); bmd.applyFilter(bmd, bmd.rect,new Point(),cmf); bmd.scroll(2,1); } |
Here is the final result:


February 14th, 2009 at 7:36 PM
Cool
Frumos efect!
February 14th, 2009 at 8:25 PM
Thanks, in the following comments please use english.
February 25th, 2009 at 9:31 PM
based on Lee’s tutorial (http://www.gotoandlearn.com/play?id=63) ?
February 25th, 2009 at 10:14 PM
Somewhat. When I starated to learn AS 3.0, Lee was a good friend for me. And on the first post I whant to publish something basic and funny. And a develop this effect.Indeed, is a very simple effect, but is funny and I like it.
Horatiu
May 10th, 2009 at 6:40 PM
I really liked this post. Can I copy it to my site? Thank you in advance.
May 11th, 2009 at 7:32 PM
Of course! I’m glad you like this effect.
Horatiu
July 24th, 2009 at 9:54 AM
[...] Read tutorial [...]
July 24th, 2009 at 9:54 AM
[...] Read tutorial [...]
March 16th, 2010 at 8:46 PM
can i translate in Russian and post on my blog? )
March 18th, 2010 at 5:40 PM
Yes! But provide the original link!