看效果:
那天在网上看到一个
效果,感觉不错,今天晚上没事自己也模拟了一下。做得不好,希望大家不要见笑!
//////
//椭圆短半轴
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();
源文件下载:
mohu.rar进入论坛和作者讨论学习:
http://space.flash8.net/bbs/thread-354184-1-1.html