himo
/**
* Copyright fakestar0826 ( http://wonderfl.net/user/fakestar0826 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/dyrt
*/
package {
import flash.geom.Point;
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite
{
private var _points:Vector.<Point>;
public function FlashTest() {
// write as3 code here..
_points = new Vector.<Point>();
for(var i:int = 0;i < 10; i++)
{
_points[i] = new Point(0, 0);
}
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(e:Event):void
{
graphics.clear();
graphics.lineStyle(0);
for(var i:int = 0;i < _points.length; i++)
{
if(i == 0)
{
_points[0].x += (mouseX - _points[0].x) * 0.2;
_points[0].y += (mouseY - _points[0].y) * 0.2;
}
else
{
_points[i].x += (_points[i - 1].x - _points[i].x) * 0.2;
_points[i].y += (_points[i - 1].y - _points[i].y) * 0.2;
}
}
for(i = 0;i < _points.length - 1; i++)
{
if(i == 0)
{
graphics.moveTo(_points[0].x, _points[0].y);
}
else
{
graphics.curveTo(_points[i].x, _points[i].y, _points[i + 1].x, _points[i + 1].y);
}
}
}
}
}