Follow | Mouse First look at the effect
http://www.flash8.net/bbs/UploadFile/2005-6/200562412045497.swf
Because it is all written as, so I do not put the source file, as long as the copy as code to flash in the first frame can be
Stage.scalemode = "Noscale"
Stage.align = "TL"
For (I=1 i<=4; i++) {
_root.createemptymovieclip ("point" +i, 0-i);/New MC
MC X-axis, y-axis
_root["point" +i]._x = STAGE.WIDTH/2;
_root["point" +i]._y = STAGE.HEIGHT/2;
The effect of the mouse across
_root["point" +i].onmousemove = function () {
this._x = _root._xmouse+ (Math.random () *70)-35;
this._y = _root._ymouse+ (Math.random () *70)-35;
};
}
Set a color group
Hexcolors = new Array ("0xcc00ff", "0xcc33ff", "0xcc66ff", "0xcc99ff", "0xCCCCFF", "0xCCFFFF");
The new MC when the mouse is across, and randomly fill the color and set the alpha value randomly
This.onmousemove = function () {
i++;
This.createemptymovieclip ("Shape" +i, I *10);
With (this["shape" +i]) {
Beginfill (Hexcolors[math.floor (Math.random () *hexcolors.length)], (Math.random () *40) +60);
Execute Line Drawing Program
MoveTo (_root.point1._x, _root.point1._y);
Curveto (_root.point2._x, _root.point2._y, _root.point3._x, _root.point3._y);
Curveto (_root.point4._x, _root.point4._y, _root.point1._x, _root.point1._y);
Endfill ();
}
Copy the current MC, set the x,y axis, alpha values, and fill the color as shadows.
this["Shape" +i].duplicatemovieclip ("Shadow" +i, (10*i)-1);
This["Shadow" +i]._x = this["Shape" +i]._x-6;
This["Shadow" +i]._y = this["Shape" +i]._y + 6;
This["Shadow" +i]._alpha = 60;
This.grey = new Color (this["Shadow" +i));
This.grey.setRGB ("0x999999");
};
Only a simple explanation, suitable for a friend with as basis to learn
Stage.scalemode = "Noscale";
Stage.align = "TL";
For (I=1 i<=4; i++) {
_root.createemptymovieclip ("point" +i, 0-i);
New MC
MC X-axis, y-axis
_root["point" +i]._x = STAGE.WIDTH/2;
_root["point" +i]._y = STAGE.HEIGHT/2;
The effect of the mouse across
_root["point" +i].onmousemove = function () {
this._x = _root._xmouse+ (Math.random () *70)-35;
this._y = _root._ymouse+ (Math.random () *70)-35;
};
}
Set a color group
Hexcolors = new Array ("0xcc00ff", "0xcc33ff", "0xcc66ff", "0xcc99ff", "0xCCCCFF", "0xCCFFFF");
The new MC when the mouse is across, and randomly fill the color and set the alpha value randomly
This.onmousemove = function () {
i++;
This.createemptymovieclip ("Shape" +i, i*10);
With (this["shape" +i]) {
Beginfill (Hexcolors[math.floor (Math.random () *hexcolors.length)], (Math.random () *40) +60);
Execute Line Drawing Program
MoveTo (_root.point1._x, _root.point1._y);
Curveto (_root.point2._x, _root.point2._y, _root.point3._x, _root.point3._y);
Curveto (_root.point4._x, _root.point4._y, _root.point1._x, _root.point1._y);
Endfill ();
}
Copy the current MC, set the x,y axis, alpha values, and fill the color as shadows.
this["Shape" +i].duplicatemovieclip ("Shadow" +i, (10*i)-1);
This["Shadow" +i]._x = this["Shape" +i]._x-6;
This["Shadow" +i]._y = this["Shape" +i]._y+6;
This["Shadow" +i]._alpha = 60;
This.grey = new Color (this["Shadow" +i));
This.grey.setRGB ("0x999999");
};
Added a section of deleted
var ii:number = 6;
Function del () {
if (_root["shape" +ii]) {
_root["Shape" +ii].removemovieclip ();
_root["Shadow" +ii].removemovieclip ();
ii++;
}
}
SetInterval (Del, 10);
The effect is as follows:
http://www.flash8.net/bbs/UploadFile/2005-6/200562418334546.swf
The original actually better look, the more change the more bad look
Import Mx.transitions.Tween;
Import mx.transitions.easing.*;
var i:number = 0;
var mcname:number = 0;
var x:number = _xmouse, y:number = _ymouse;
var rgb:array = new Array ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
var mousemove:object = new Object ();
Mousemove.onmousemove = function () {
Fline ();
};
function Fline () {
var a:number = Math.floor (Math.random () *16);
var b:number = Math.floor (Math.random () *16);
var c:number = Math.floor (Math.random () *16);
var d:number = Math.floor (Math.random () *16);
var e:number = Math.floor (Math.random () *16);
var f:number = Math.floor (Math.random () *16);
var g:number = Math.floor (Math.random () *6);
This.createemptymovieclip ("line" +i, I);
MyColor = new Color (this["line" +i]);
Mycolor.setrgb ("0x" +rgb[a]+rgb[b]+rgb[c]+rgb[d]+rgb[e]+rgb[f]);
With (this["line" +i]) {
LineStyle (g, 0x0000, 100);
MoveTo (x, y);
LineTo (_xmouse, _ymouse);
}
x = _xmouse;
y = _ymouse;
MCNAME_MC = this["line" +i];
i++;
}
SetInterval (Enterframes, 10);
function Enterframes () {
if (_root["line" +mcname]) {
Fdown (_root["line" +mcname]);
mcname++;
}
}
function Fdown (mc_mc:movieclip) {
var i:number = mc_mc._y;
down = new Tween (MC_MC, "_y", Elastic.easein, I, i+200, 1, true);
down.onmotionstopped = function () {
Mc_mc.removemovieclip ();
};
}
Mouse.addlistener (MouseMove);
The original:
Import Mx.transitions.Tween;
Import mx.transitions.easing.*;
var i:number = 0;
var mcname:number = 0;
var x:number = _xmouse, y:number = _ymouse;
var mousemove:object = new Object ();
Mousemove.onmousemove = function () {
Fline ();
};
function Fline () {
var a:number = Math.random () *5;
var b:number = Math.random () *100;
This.createemptymovieclip ("line" +i, I);
With (this["line" +i]) {
LineStyle (1, 0x0000, 100);
MoveTo (x, y);
LineTo (_xmouse, _ymouse);
}
x = _xmouse;
y = _ymouse;
MCNAME_MC = this["line" +i];
i++;
}
SetInterval (Enterframes, 10);
function Enterframes () {
if (_root["line" +mcname]) {
Fdown (_root["line" +mcname]);
mcname++;
}
}
function Fdown (mc_mc:movieclip) {
var i:number = mc_mc._y;
down = new Tween (MC_MC, "_y", Elastic.easein, I, i+200, 1, true);
down.onmotionstopped = function () {
Mc_mc.removemovieclip ();
};
}
Mouse.addlistener (MouseMove);
The effect is as follows:
http://www.flash8.net/bbs/UploadFile/2005-6/20056240037515.swf