Lightning
This is going to be the hardest. My intention is to have the lightning striking outwards from the finger tips of the users flash cursor and for the lightning to strike areas of the stage. However, in practice I've come to realise this to be far too hard.
The following are some of my attempts, and some of my failures. However, this has been one of the most rewarding experiments I've ever attempted. This is AS that I've never attempted before and the results were actually quite pleasing, if not what I'd attempted for at first.
It has to be said that I spent far too much time on this aspect of the project getting far too involved with code that I knew from the offset would ultimately be too far from reach.
The actual design I went with for this landscape banner is entirely different, simpler and after much deliberation, preferable.
The following are links to the hosted SWF files. At the very end of the post will be listed the code I used to get this effect.
The final attempt with some effects thrown in for good measure.
//////////////////////////////////////////
//Sorry for the formatting, Flash won't format my code properly.
//the simple code
i = 0;
fscommand("allowscale", "false");
onEnterFrame = function () {;
var line_mc = attachMovie("line_mc", "line_mc", i);
i++;
xpos1 = _root.circle1_mc._x;
ypos1 = _root.circle1_mc._y;
xpos2 = _root.circle2_mc._x;
ypos2 = _root.circle2_mc._y;
xscale = xpos2 - xpos1;
yscale = ypos2 - ypos1;
line_mc._x = xpos1;
line_mc._y = ypos1;
line_mc._xscale = xscale;
line_mc._yscale = yscale;
};
//the more complicated code
i = 0;
xPlace = 90;
yPlace = random(160);
bolt = function () {;
p -= 5;
p = 50;
glowXScale = 200;
glowYScale = 200;
for (i = 1; i < 70; i++) { ;
circle1_mc.removeMovieClip();circle2_mc.removeMovieClip();//line_mc.removeMovieClip();
circle1Place = {_x: xPlace, _y: yPlace};
var circle1_mc = attachMovie("circle_mc", "circle1_mc", i, circle1Place);i++;
var glow_mc = attachMovie("glow_mc", "glow_mc", i, circle1Place);i++;
circle1X = circle1_mc._x;
glow_mc._xscale = glowXScale;
glow_mc._yscale = glowYScale;
glowXScale -= 15;
glowYScale -= 15;
newPos = {_x: xPlace+p, _y: random(40)+10};
var circle2_mc = attachMovie("circleblue_mc", "circle2_mc", i, newPos);i++;
xPlace = circle2_mc._x;
yPlace = circle2_mc._y;
var line_mc = attachMovie("line_mc", "line_mc", i);i++;
xpos1 = _root.circle1_mc._x;
ypos1 = _root.circle1_mc._y;
xpos2 = _root.circle2_mc._x;
ypos2 = _root.circle2_mc._y;
xscale = xpos2 - xpos1;
yscale = ypos2 - ypos1;
line_mc._x = xpos1;
line_mc._y = ypos1;
line_mc._xscale = xscale;
line_mc._yscale = yscale;
//
p -= 5;
xPlace = 1;
yPlace = random(50)+25;
p = 50;
glowXScale = 200;
glowYScale = 200;
};
for (i = 1; i < 50; i++) { ;
circle1_mc.removeMovieClip();circle2_mc.removeMovieClip();//line_mc.removeMovieClip();
circle1Place = {_x: xPlace, _y: yPlace};
var circle1_mc = attachMovie("circle_mc", "circle1_mc", i, circle1Place);i++;
var glow_mc = attachMovie("glow_mc", "glow_mc", i, circle1Place);i++;
circle1X = circle1_mc._x;
glow_mc._xscale = glowXScale;
glow_mc._yscale = glowYScale;
glowXScale -= 15;
glowYScale -= 15;
newPos = {_x: xPlace+p, _y: random(40)+10};
var circle2_mc = attachMovie("circleblue_mc", "circle2_mc", i, newPos);i++;
xPlace = circle2_mc._x;
yPlace = circle2_mc._y;
var line_mc = attachMovie("line_mc", "line_mc", i);i++;
xpos1 = _root.circle1_mc._x;
ypos1 = _root.circle1_mc._y;
xpos2 = _root.circle2_mc._x;
ypos2 = _root.circle2_mc._y;
xscale = xpos2 - xpos1;
yscale = ypos2 - ypos1;
line_mc._x = xpos1;
line_mc._y = ypos1;
line_mc._xscale = xscale;
line_mc._yscale = yscale;
};
};
setInterval(bolt, 500);
No comments:
Post a Comment