Author Archives: Zevan

Wireframe Plane 2D

CLICK HERE TO COPY
Actionscript:

var plane:Shape = Shape(addChild(new Shape()));

plane.x = plane.y = 50;

 

var verts:Vector.<Number> = new Vector.<Number>();

var indices:Vector.<int> = new Vector.<int>();

var rows:int = 20;

var size:Number = rows + 1;

var vertNum:Number = size * size;

var polySize:Number = 20;

var vIndex:int = 0;

for (var i:Number = 0; i<vertNum; i++){

    verts[vIndex++] = i % size * polySize;

    verts[vIndex++] [...]

Posted in Graphics, Vector | Tagged , , | Leave a comment

drawTriangles() Terrain

CLICK HERE TO COPY
Actionscript:

[SWF(width=500,height=500,backgroundColor=0x333333, frameRate=40)]

var terrain:Shape = Shape(addChild(new Shape()));

terrain.x = terrain.y = 250;

var rows:int = 60;

var size:int = rows + 1;

var vertNum:int = size * size;

var polySize:Number = 5;

var gridWidth:Number = polySize * rows;

var halfWidth:Number = gridWidth / 2;

var verts:Vector.<Number> = new Vector.<Number>();

var pVerts:Vector.<Number> = new Vector.<Number>();

var indices:Vector.<int> = new Vector.<int>();

var uvs:Vector.<Number> = new Vector.<Number>();

var [...]

Posted in BitmapData, Graphics, Vector, pixel manipulation, setPixel | Tagged , , | 4 Comments

Variable Line Resolution #2

CLICK HERE TO COPY
Actionscript:

var loc:Vector.<Point> = new Vector.<Point>();

var lifts:Vector.<int> = new Vector.<int>();

var index:int = 0;

var resolution:int = 1;

var down:Boolean;

stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown);

stage.addEventListener(MouseEvent.MOUSE_UP, onUp);

stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyReleased);

addEventListener(Event.ENTER_FRAME, onLoop);

function onKeyReleased(evt:KeyboardEvent):void{

    if (evt.keyCode == Keyboard.RIGHT){

        resolution -= 1;

        if (resolution <1) resolution = 1;

    }else

    if (evt.keyCode == Keyboard.LEFT){

        [...]

Posted in Graphics, misc | Tagged , , | 2 Comments

Variable Line Resolution

CLICK HERE TO COPY
Actionscript:

var loc:Vector.<Point> = new Vector.<Point>();

var lifts:Vector.<int> = new Vector.<int>();

var index:int = 0;

var resolution:int = 1;

var down:Boolean;

stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown);

stage.addEventListener(MouseEvent.MOUSE_UP, onUp);

stage.addEventListener(KeyboardEvent.KEY_UP, onKeyReleased);

addEventListener(Event.ENTER_FRAME, onLoop);

function onKeyReleased(evt:KeyboardEvent):void{

    if (evt.keyCode == Keyboard.RIGHT){

        resolution -= 1;

        if (resolution <1) resolution = 1;

    }else

    if (evt.keyCode == Keyboard.LEFT){

        [...]

Posted in Graphics, Vector | Tagged , , | 3 Comments