| 几种线条效果 |
作者:ycccc820… 文章来源:闪吧 点击数:
更新时间:2004-12-12 04:55:39 |
|
| |
|
主要代码就是通过下面的进行一些调整就出来了好几种效果:
Stage.scaleMode = "noScale"; var depths = 1; this.createEmptyMovieClip("dot", 0); this.createEmptyMovieClip("l", -1); with (dot) { lineStyle(1, 0xffffff); lineTo(1, 0); _visible = false; } function drawLine() { for (var i = depths; i<depths+4; i++) { var d = dot.duplicateMovieClip("dot"+i, i, {_x:random(400), _y:random(400), a:0}); line = l.createEmptyMovieClip("line"+i, i); line.clear(); line.lineStyle(1, 0xffffff); line.moveTo(d._x, d._y); d.onEnterFrame = function() { this.a += 5; this.dx = posx-this._x; this.dy = posy-this._y; this.dis = Math.sqrt(this.dx*this.dx+this.dy*this.dy); this.r = Math.atan2(this.dy, this.dx); this._x += this.dx/7-Math.sin(this.r)*this.dis/7*Math.sin(this.a*2); this._y += this.dy/7+Math.cos(this.r)*this.dis/7*Math.sin(this.a*2); this._parent.l["line"+this._name.substr(3)].lineStyle(1, 0xff0000, this.a); this._parent.l["line"+this._name.substr(3)].lineTo(this._x, this._y); if (Math.abs(this._x-posx)<1 and Math.abs(this._y-posy)<1) { this.removeMovieClip(); } }; } } this.onMouseDown = function() { posx = _xmouse; posy = _ymouse; drawLine(); depths = depths>12 ? 1 : depths+4; };
//as区已加分:) |
| 教程录入:流云 责任编辑:流云
|
|
上一篇教程: 竖直方向的弹簧振子效果
下一篇教程: 流水效果 |
| 【字体:小
大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】
|