Trailer : Adobe flash cs4 tutorial Ghost Effect
Dalam video tutorial ini Anda akan mempelajari cara untuk menciptakan efek ghosting populer di banyak video game dan website.
var ghostmode:Boolean = false;
var cmf:ColorMatrixFilter = new ColorMatrixFilter([1,0,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,1,0]);
var bmd:BitmapData = new BitmapData(550,400,true,0x00ffffff);
var bm:Bitmap = new Bitmap(bmd);
var con:MovieClip = new MovieClip();
var ship:MovieClip = new sp();
addChild(bm);
addChild(con);
con.addChild(ship);
function moveship(e:Event){
var temp:MovieClip = MovieClip(con.getChildAt(0));
temp.x = mouseX;
temp.y = mouseY;
}
function ghost(e:Event){
if(ghostmode){
ghostmode=false;
}else{
ghostmode=true;
}
}
function loop(e:Event){
if(ghostmode){
bmd.draw(con);
cmf.matrix =[0,0,0,0,255,
0,0,0,0,255,
0,0,0,0,0,
0,0,0,.8,0];
}
bmd.applyFilter(bmd,bmd.rect,new Point(0,0),cmf);
}
addEventListener(MouseEvent.MOUSE_MOVE,moveship);
addEventListener(Event.ENTER_FRAME,loop);
addEventListener(MouseEvent.CLICK,ghost);
var cmf:ColorMatrixFilter = new ColorMatrixFilter([1,0,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,1,0]);
var bmd:BitmapData = new BitmapData(550,400,true,0x00ffffff);
var bm:Bitmap = new Bitmap(bmd);
var con:MovieClip = new MovieClip();
var ship:MovieClip = new sp();
addChild(bm);
addChild(con);
con.addChild(ship);
function moveship(e:Event){
var temp:MovieClip = MovieClip(con.getChildAt(0));
temp.x = mouseX;
temp.y = mouseY;
}
function ghost(e:Event){
if(ghostmode){
ghostmode=false;
}else{
ghostmode=true;
}
}
function loop(e:Event){
if(ghostmode){
bmd.draw(con);
cmf.matrix =[0,0,0,0,255,
0,0,0,0,255,
0,0,0,0,0,
0,0,0,.8,0];
}
bmd.applyFilter(bmd,bmd.rect,new Point(0,0),cmf);
}
addEventListener(MouseEvent.MOUSE_MOVE,moveship);
addEventListener(Event.ENTER_FRAME,loop);
addEventListener(MouseEvent.CLICK,ghost);