工大在线
标题:
flash一个小例子
[打印本页]
作者:
痞子
时间:
2006-11-21 13:59
标题:
flash一个小例子
今天乱跑的时候,看到了一个场景,感觉作的不错,就试着一把,还真能做成
演示地址:
http://cbbestdone.googlepages.com/loading2.swf
如果想要源码的可以下载下面的fla
下载fla]
制作过程
第一步:将LOADING分离,每个字母转换成一个元件。。。
第二步:分别起实例名为——m1b1~m7b1(注意,一定按照倒序排列,就是字母G对应的是m7b1)
第三步:加上以下脚本即可。。。。
t = 0;
// The number of characters
n = 7;
// The number of character copies
b = 4;
// Create three additional copies of each character
depth = 100;
for (i=1; i<=n; i++) {
for (j=2; j<=b; j++) {
eval("m"+i+"b1").duplicateMovieClip("m"+i+"b"+j, depth);
depth++;
}
}
this.onEnterFrame = function() {
// increment the position along the path
t += .0582;
// Keep values in the range 0 to 2*pi
if (t>6.283) {
t -= 6.283;
}
// Iterate over all n (7) characters
for (i=1; i<=n; i++) {
// offset each character by .2617 radians or 15 degrees
u = (t+i*.2617);
// v is used for scale as it corresponds to when u is
// farthest from the viewer.
v = Math.abs(Math.cos(u/2));
c = Math.cos(u);
// dx, dy is the position of the character
dx = 50*c+35;
dy = 100*Math.sin(u)+150;
// Iterate over each copy of a particular character
for (j=1; j<=4; j++) {
// Reference a particular character copy
m = eval("m"+i+"b"+j);
// We offset each copy of the character and adjust
// the scale and alpha appropriately
offset = (1-v)*4;
m._yscale = c*100+100*v;
m._xscale = 200*v;
m._alpha = 10+90*v;
m._x = dx+offset*Math.cos(j*1.57)+50*(n+1-i);
m._y = dy+offset*Math.sin(j*1.57);
}
}
};
复制代码
欢迎光临 工大在线 (http://ruolanmy.hk1.ifreeurl.com/)
Powered by Discuz! X2.5