Flash 动画:
这是HBB的blog上的一个拖曳线条的效果,我改进了一下,使两个按钮都可以拖动
做两个按钮,或者mc都可以,命名为point和hole,放入主场景中
第一帧的代码如下:
lineColor_array = ["0xffffff", "0x89C2D6", "0x691903","0x3C8DA8", "0x2D697D", "0xBBDDE8"];
vx=0
vy=0
cx=0
cy=0
function drawEaseCurve(a, b) {
tx = (a._x+b._x)/2;
ty = (a._y+b._y)/2;
vx = vx*.7+(tx-cx)*.2;
vy = vy*.7+(ty-cy)*.2;
cx += vx+50;
cy += vy+100;
var n = -1;
while ((++n)<6) {
var room = _level0.createEmptyMovieClip("r"+n, n);
with (room) {
clear();
lineStyle(6-n, lineColor_array[n], 100);
moveTo(a._x, a._y);
curveTo(cx, cy, b._x, b._y);
}
}
}
point.swapDepths(1000);
_level0.onEnterFrame = function() {
drawEaseCurve(point, hole);
};
按钮point的代码:
on(press) {
startDrag("/point",true,0,0,Stage.width,Stage.height);
}
on(release, releaseOutside){
stopDrag()
}
按钮hole的代码:
on(press) {
startDrag("/hole",true,0,0,Stage.width,Stage.height);
}
on(release, releaseOutside){
stopDrag()
}
这样就好了,测试吧~!
回复Comments
作者:
{commentrecontent}