PDA

View Full Version : Alpha fade grid



Ben H
January 14th, 2006, 03: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
January 14th, 2006, 09:44 AM
Neato

icio
January 14th, 2006, 10:20 AM
Pretty cool :)

Ben H
January 15th, 2006, 07: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
January 15th, 2006, 07: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
January 15th, 2006, 08:13 AM
Nice! :D

Ben H
January 15th, 2006, 09:17 AM
thanks :D