【文件属性】:
文件名称:鼠标跟随鼠标跟随效果FLASH
文件大小:827B
文件格式:SWF
更新时间:2012-01-11 10:03:17
FLASH
鼠标跟随效果FLASH
新建FLASH空白文档,然后打开动作面板粘贴代码即可
function 鼠标跟随(myString, a, b, c, txtspeed)
{
Mouse.hide();
var i = 0;
while (i < String_num)
{
this["dx" + i] = 0;
this["dy" + i] = 0;
var mc = _root.createEmptyMovieClip("txt" + i, i);
this["color" + i] = new Color(mc);
with (mc)
{
_xscale = _yscale = txtspeed;
createTextField("mytxt", i, 0, 0, 0, 0);
mytxt.autoSize = true;
mytxt.text = myString.substr(i, 1);
} // End of with
i++;
} // end while
_root.onEnterFrame = function ()
{
txt0._x = _root._xmouse;
txt0._y = _root._ymouse;
var _l3 = 0;
while (_l3 < String_num)
{
this["color_from" + _l3] = {ra: 5 * _l3, rb: 255 - 2 * _l3, ga: _l3 * 20 - 100, gb: Math.floor(Math.random() * 500 -
255), gb: 100 - 20 * _l3, ba: 5 * _l3 - 50, bb: Math.floor(Math.random() * 500 - 255)};
this["color" + _l3].setTransform(this["color_from" + _l3]);
this["dx" + _l3] = this["dx" + _l3] * a + (this["txt" + (_l3 - 1)]._x + c - this["txt" + _l3]._x) * b;
this["dy" + _l3] = this["dy" + _l3] * a + (this["txt" + (_l3 - 1)]._y - this["txt" + _l3]._y) * b;
this["txt" + _l3]._x = this["txt" + _l3]._x + this["dx" + _l3];
this["txt" + _l3]._y = this["txt" + _l3]._y + this["dy" + _l3];
_l3++;
} // end while
};
}
var myString = "榭YOYO,欢迎光临。To Be No.1!";
var a = 0.650000;
var b = 0.100000;
var c = 15;
var txtspeed = 150;
var String_num = myString.length;
鼠标跟随(myString, a, b, c, txtspeed);
网友评论
- 很实用,多谢分享!