PDA

View Full Version : Alpha fade grid


Ben H
01-14-2006, 02:07 AM
EDIT: Ok, final version...


stagewidth = Stage.width; // Width of your stage;
squaresrow = 16; // Number of squares in a row.
col = 0x648502; // Colour of squares.
loc = 1;
function dopx() {
al=loc;
var pos = [0,0];
for (i=0;i<(squaresrow*squaresrow);i++) {
_root.beginFill(col,al);
_root.moveTo(pos[0],pos[1]);
_root.lineTo(pos[0]+(stagewidth/squaresrow),pos[1]);
_root.lineTo(pos[0]+(stagewidth/squaresrow),pos[1]+(stagewidth/squaresrow));
_root.lineTo(pos[0],pos[1]+(stagewidth/squaresrow));
_root.lineTo(pos[0],pos[0]);
al -= 100/(squaresrow*squaresrow);
pos = [pos[0]+(stagewidth/squaresrow),pos[1]];
if (pos[0]==stagewidth || pos[0]>stagewidth) {
pos = [0,pos[1]+(stagewidth/squaresrow)];
}
}
loc++;
}
onEnterFrame = function() {
_root.clear();
dopx();
}


-Ben

Seb Hughes
01-14-2006, 08:44 AM
Neato

icio
01-14-2006, 09:20 AM
Pretty cool :)

Ben H
01-15-2006, 06:28 AM
Update: White square fixed, I was doing beginFill too late.


stagewidth = Stage.width; // Width of your stage;
squaresrow = 16; // Number of squares in a row.
col = 0x648502; // Colour of squares.
loc = 1;
function dopx() {
al=loc;
var pos = [0,0];
for (i=0;i<(squaresrow*squaresrow);i++) {
_root.beginFill(col,al);
_root.moveTo(pos[0],pos[1]);
_root.lineTo(pos[0]+(stagewidth/squaresrow),pos[1]);
_root.lineTo(pos[0]+(stagewidth/squaresrow),pos[1]+(stagewidth/squaresrow));
_root.lineTo(pos[0],pos[1]+(stagewidth/squaresrow));
_root.lineTo(pos[0],pos[0]);
al += 100/(squaresrow*squaresrow);
pos = [pos[0]+(stagewidth/squaresrow),pos[1]];
if (pos[0]==stagewidth || pos[0]>stagewidth) {
pos = [0,pos[1]+(stagewidth/squaresrow)];
}
}
loc++;
}
onEnterFrame = function() {
_root.clear();
dopx();
}


-Ben

Ben H
01-15-2006, 06:51 AM
One final update... Made the effect cooler...


stagewidth = Stage.width; // Width of your stage;
squaresrow = 16; // Number of squares in a row.
col = 0x648502; // Colour of squares.
loc = 1;
function dopx() {
al=loc;
var pos = [0,0];
for (i=0;i<(squaresrow*squaresrow);i++) {
_root.beginFill(col,al);
_root.moveTo(pos[0],pos[1]);
_root.lineTo(pos[0]+(stagewidth/squaresrow),pos[1]);
_root.lineTo(pos[0]+(stagewidth/squaresrow),pos[1]+(stagewidth/squaresrow));
_root.lineTo(pos[0],pos[1]+(stagewidth/squaresrow));
_root.lineTo(pos[0],pos[0]);
al -= 100/(squaresrow*squaresrow);
pos = [pos[0]+(stagewidth/squaresrow),pos[1]];
if (pos[0]==stagewidth || pos[0]>stagewidth) {
pos = [0,pos[1]+(stagewidth/squaresrow)];
}
}
loc++;
}
onEnterFrame = function() {
_root.clear();
dopx();
}


-Ben

Sammo
01-15-2006, 07:13 AM
Nice! :D

Ben H
01-15-2006, 08:17 AM
thanks :D