Author Archives: Zevan

Wave Trick

CLICK HERE TO COPY
Actionscript:

[SWF(width=800, height=600)]

var dupes:int = 5

var pntNum:int = 180;

 

var hh:Number = stage.stageHeight / 2;

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

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

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

var vectors:Vector.<Shape> = new Vector.<Shape>();

 

for (var i:int = 0; i<dupes; i++){

    vectors[i] = Shape(addChildAt(new Shape(),0));

    vectors[i].x = 10 * i;

    vectors[i].y = -10 * i;

}

var [...]

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

Summarize Contents of Array

CLICK HERE TO COPY
Actionscript:

var a:Array = [true, true, true, false, false, true, true, true, false];

 

var counter:int = 0;

var prev:Boolean;

var summary:Array = [];

for (var i:int = 1; i<a.length; i++){

    prev = a[i - 1]

    counter++;

    if (prev != a[i]){

        if (prev){

            summary.push("true: "+ counter);

    [...]

Posted in arrays, misc | Tagged , , | 8 Comments

Sphere of Squares

CLICK HERE TO COPY
Actionscript:

[SWF(width = 600, height = 600, backgroundColor=0x000000)]

var squareNum:int  = 1000;

var hw:Number = stage.stageWidth / 2;

var hh:Number = stage.stageHeight / 2;

// verts defines a single square

var verts:Vector.<Number> = Vector.<Number>([-20, 0, 0, 20, 0, 0, 20, 0, 40, -20, 0, 40, -20, 0, 0]);

var cmds:Vector.<int> = Vector.<int>([1,2,2,2,2]);

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

var newVerts:Vector.<Number> = new [...]

Posted in 3D, BitmapData, Vector | Tagged , , , | 12 Comments

transformVectors() and drawPath()

CLICK HERE TO COPY
Actionscript:

var squareNum:int  = 100;

// verts defines a single square

var verts:Vector.<Number> = Vector.<Number>([-20, 0, 0, 20, 0, 0, 20, 0, 40, -20, 0, 40, -20, 0, 0]);

var cmds:Vector.<int> = Vector.<int>([1,2,2,2,2]);

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

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

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

var uv:Vector.<Number> = new Vector.<Number>(15 * squareNum);

 

var m:Matrix3D = new [...]

Posted in 3D, Graphics, Vector | 2 Comments