s3d
...
@author lizhi http://game-develop.net/
/**
* Copyright lizhi ( http://wonderfl.net/user/lizhi )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/qk2m
*/
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>;
public function Test3D()
{
x = stage.stageWidth / 2;
y = stage.stageHeight / 2;
for (var i:int=0; i < 100;i++ ) {
vs.push(new Vector3D(0, 0, 100 + i * 10));
}
addEventListener(Event.ENTER_FRAME, enterFrame);
}
private function enterFrame(e:Event):void
{
graphics.clear();
var lv:Vector3D = new Vector3D(mouseX, mouseY);
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, 30 * fz);
}
}
}
}