小技巧:纯AS的运动模糊效果-Flash教程
来源: 作者:
更新时间:2008-03-04
点击:
import flash.filters.*;
var blur:BlurFilter = new BlurFilter(blurX, blurY, 1);
var num = 10;
for (var i = 0; i<num; i ) {
scale = random(300);
alpha = random(10000/scale) 30;
var temp_mc = _root.createEmptyMovieClip(\"ball\" i, this.getNextHighestDepth());
temp_mc.createTextField(\"my_txt\", 1, 0, 0, 300, 100);
temp_mc.my_txt.multiline = true;
temp_mc.my_txt.wordWrap = true;
temp_mc.my_txt.text = \"WWW.3C800.COM\";
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFF6600;
my_fmt.size = 20;
my_fmt.font = \"BM bug\";
temp_mc.my_txt.setTextFormat(my_fmt);
with (temp_mc) {
_x = random(Stage.width);
_y = random(Stage.height);
_xscale = scale;
_yscale = scale;
_alpha = alpha;
}
temp_mc.onEnterFrame = function() {
Yspeed = (Stage.height/2-_ymouse)/this._yscale*12;
Xspeed = (Stage.width/2-_xmouse)/this._xscale*12;
blur.blurX = Math.abs(Xspeed);
blur.blurY = Math.abs(Yspeed);
this.filters = [blur];
this._y = Yspeed;
if (this._y>Stage.height) {
this._y = 0;
}
if (this._y<0) {
this._y = Stage.height;
}
this._x = Xspeed;
if (this._x>Stage.width) {
this._x = 0;
}
if (this._x<0) {
this._x = Stage.width;
}
};
}
var blur:BlurFilter = new BlurFilter(blurX, blurY, 1);
var num = 10;
for (var i = 0; i<num; i ) {
scale = random(300);
alpha = random(10000/scale) 30;
var temp_mc = _root.createEmptyMovieClip(\"ball\" i, this.getNextHighestDepth());
temp_mc.createTextField(\"my_txt\", 1, 0, 0, 300, 100);
temp_mc.my_txt.multiline = true;
temp_mc.my_txt.wordWrap = true;
temp_mc.my_txt.text = \"WWW.3C800.COM\";
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFF6600;
my_fmt.size = 20;
my_fmt.font = \"BM bug\";
temp_mc.my_txt.setTextFormat(my_fmt);
with (temp_mc) {
_x = random(Stage.width);
_y = random(Stage.height);
_xscale = scale;
_yscale = scale;
_alpha = alpha;
}
temp_mc.onEnterFrame = function() {
Yspeed = (Stage.height/2-_ymouse)/this._yscale*12;
Xspeed = (Stage.width/2-_xmouse)/this._xscale*12;
blur.blurX = Math.abs(Xspeed);
blur.blurY = Math.abs(Yspeed);
this.filters = [blur];
this._y = Yspeed;
if (this._y>Stage.height) {
this._y = 0;
}
if (this._y<0) {
this._y = Stage.height;
}
this._x = Xspeed;
if (this._x>Stage.width) {
this._x = 0;
}
if (this._x<0) {
this._x = Stage.width;
}
};
}
相关Flash教程:
最新评论:
评论加载中....
发表评论:不能超过250字节,请自觉遵守互联网相关政策法规.
- 昵称: 验证:







