图片运动模糊特效
效果图:
那天在网上看到一个效果,感觉不错,今天晚上没事自己也模仿了一下。做得不好,希望大家不要见笑!
//////
//椭圆短半轴
var H = 80;
//椭圆长半轴
var W = 200;
//定义弧度的增量n
var n = 0;
//定义椭圆的中心坐标
var cenX = Stage.width/2;
var cenY = Stage.height/2-70;
//通过函数Move使3个mc位于椭圆上
function Move() {
for (i=1; i<=4; i++) {
//得到每个mc的弧度
radian = 2*i*Math.PI/4;
temp = this["p"+i];
//设置mc的坐标
temp._x = cenX+Math.sin(n+radian)*W;
temp._y = cenY+Math.cos(n+radian)*H;
}
}
//函数setPosition设置当单击按钮是mc的移动情况
function setPosition() {
for (k=1; k<=4; k++) {
temp1 = this["p"+k+"_btn"];
//为每个btn定义变量
temp1.t = k;
temp1.onRollOver = function() {
mc_filters(_root["p"+this.t]);
m = this.t;
onEnterFrame = function () {
n += (-2*Math.PI*m/4-n)/12;
Move();
if (n == 2*Math.PI*m/4) {
delete onEnterFrame;
}
};
};
}
}
//模糊滤镜,先导入滤镜
import flash.filters.*;
function mc_filters(mc) {
//定义模糊的初值
var max = 100;
mc.onEnterFrame = function() {
if (max>=0) {
max -= 3;
mc.filters = [new BlurFilter(max, max, 1)];
} else {
delete this.onEnterFrame;
}
};
}
Move();
setPosition();
//椭圆短半轴
var H = 80;
//椭圆长半轴
var W = 200;
//定义弧度的增量n
var n = 0;
//定义椭圆的中心坐标
var cenX = Stage.width/2;
var cenY = Stage.height/2-70;
//通过函数Move使3个mc位于椭圆上
function Move() {
for (i=1; i<=4; i++) {
//得到每个mc的弧度
radian = 2*i*Math.PI/4;
temp = this["p"+i];
//设置mc的坐标
temp._x = cenX+Math.sin(n+radian)*W;
temp._y = cenY+Math.cos(n+radian)*H;
}
}
//函数setPosition设置当单击按钮是mc的移动情况
function setPosition() {
for (k=1; k<=4; k++) {
temp1 = this["p"+k+"_btn"];
//为每个btn定义变量
temp1.t = k;
temp1.onRollOver = function() {
mc_filters(_root["p"+this.t]);
m = this.t;
onEnterFrame = function () {
n += (-2*Math.PI*m/4-n)/12;
Move();
if (n == 2*Math.PI*m/4) {
delete onEnterFrame;
}
};
};
}
}
//模糊滤镜,先导入滤镜
import flash.filters.*;
function mc_filters(mc) {
//定义模糊的初值
var max = 100;
mc.onEnterFrame = function() {
if (max>=0) {
max -= 3;
mc.filters = [new BlurFilter(max, max, 1)];
} else {
delete this.onEnterFrame;
}
};
}
Move();
setPosition();
下载地址
补充:flash教程,动画技术