into the slinky
/**
* Copyright yonatan ( http://wonderfl.net/user/yonatan )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6i5A
*/
// forked from lizhi's s3d
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
import flash.geom.Vector3D;
/**
* ...
* @author lizhi http://game-develop.net/
*/
[SWF(frameRate=60,width=465,height=465)]
public class Test3D extends Sprite
{
private var vs:Vector.<Vector3D> = new Vector.<Vector3D>;
private var fx:Number = 0, fy:Number = 0;
private var cx:Number = 0, cy:Number = 0;
public function Test3D()
{
stage.quality = "medium";
x = stage.stageWidth / 2;
y = stage.stageHeight / 2;
for (var i:int=0; i < 100;i++ ) {
vs.push(new Vector3D(0, 0, 100 + i * 50));
}
addEventListener(Event.ENTER_FRAME, enterFrame);
}
private function enterFrame(e:Event):void
{
graphics.clear();
fx = fx * 0.99 + 0.01 * (mouseX - cx);
fy = fy * 0.99 + 0.01 * (mouseY - cy);
cx += fx;
cy += fy;
var lv:Vector3D = new Vector3D(cx, cy);
for each(var v:Vector3D in vs) {
v.x += (lv.x - v.x) * .3;
v.y += (lv.y - v.y) * .3;
lv = v;
var fz:Number = 100 / v.z;
graphics.lineStyle(0,0,fz);
graphics.drawCircle(v.x * fz, v.y * fz, 660 * fz);
}
}
}
}