标题:
[原创]液滴效果
[打印本页]
作者:
紫色流星
时间:
2007-9-5 18:23
标题:
[原创]液滴效果
首次见到这个效果是在《小小作品9》上,今天终于仿制成功,特贴出来与大家分享。
图片附件:
液滴效果.JPG
(2007-9-5 18:27, 31.82 KB) / 下载次数 28
http://heubbs.com./attachment.php?aid=6112&k=b5d5323c61a7fa5460148d0dbf6b472e&t=1732397954&sid=aiT8Pb
作者:
紫色流星
时间:
2007-9-5 18:28
源代码
Stage.scaleMode = "noScale";
_root.attachMovie("LineGroup", "lg_mc", -2);
_root.attachMovie("Ball", "ball_mc", -1);
for (var i = 0; i<6; i++) {
_root.attachMovie("ChangeLine", "cl"+i+"_mc", i);
_root["cl"+i+"_mc"]._yscale=98
}
var k:Number = 0.1;
var r:Number = ball_mc._width/2;
var w:Number = Stage.width;
var h:Number = Stage.height;
lg_mc._x = w/2;
lg_mc._y = h/2;
_root.onEnterFrame = function() {
var gx:Number = _root._xmouse;
var gy:Number = _root._ymouse;
var lx:Number = ball_mc._x;
var ly:Number = ball_mc._y;
gx = gx<r ? r : gx;
gx = gx>(w-r) ? (w-r) : gx;
gy = gy<r ? r : gy;
gy = gy>(h-r) ? (h-r) : gy;
var nx = Math.floor((lx-15)/30);
var ny = Math.floor((ly-15)/30);
with (cl0_mc) {
_x = nx*30;
_y = ly;
_rotation = 180;
var d = Math.floor(Math.abs(lx-_x));
cl0_mc.gotoAndStop(d);
}
with (cl1_mc) {
_x = nx*30+30;
_y = ly;
var d = Math.floor(lx-_x);
if (d>0) {
_rotation = 180;
} else {
_rotation = 0;
}
d = Math.abs(d);
d = d == 0 ? 1 : d;
cl1_mc.gotoAndStop(d);
}
with (cl2_mc) {
_x = nx*30+60;
_y = ly;
_rotation = 0;
var d = Math.floor(Math.abs(lx-_x));
cl2_mc.gotoAndStop(d);
}
with (cl3_mc) {
_x = lx;
_y = ny*30;
_rotation = 270;
var d = Math.floor(Math.abs(ly-_y));
cl3_mc.gotoAndStop(d);
}
with (cl4_mc) {
_x = lx;
_y = ny*30+30;
var d = Math.floor(ly-_y);
if (d>0) {
_rotation = 270;
} else {
_rotation = 90;
}
d = Math.abs(d);
d = d == 0 ? 1 : d;
cl4_mc.gotoAndStop(d);
}
with (cl5_mc) {
_x = lx;
_y = ny*30+60;
_rotation = 90;
var d = Math.floor(Math.abs(ly-_y));
cl5_mc.gotoAndStop(d);
}
ball_mc._x += (gx-lx)*k;
ball_mc._y += (gy-ly)*k;
};
复制代码
作者:
紫色流星
时间:
2007-9-5 18:31
下载包:
Flash影音文件*1,IE播放文件*1(用于那些无法正常播放swf文件的用户)
附件:
液滴效果.rar
(2007-9-5 18:31, 2.43 KB) / 下载次数 160
http://heubbs.com./attachment.php?aid=6113&k=15d59e108d347dd742f6fab2a06adf07&t=1732397954&sid=aiT8Pb
欢迎光临 工程家园 (http://heubbs.com./)
Powered by Discuz! 7.2