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);
} |