Author Archives: Zevan

QuickBox2D Vaguely Goldberg-esque

CLICK HERE TO COPY
Actionscript:

import com.actionsnippet.qbox.*;

import Box2D.Common.Math.*;

import Box2D.Collision.Shapes.*;

 

[SWF(width = 800, height = 600, backgroundColor = 0xFFFFFF, frameRate=60)]

 

// hide everything for 300 ms

visible = false;

setTimeout(function():void{ visible = true}, 300);

 

var sim:QuickBox2D = new QuickBox2D(this, {debug:false});

 

sim.setDefault({fillColor:0x666666, lineAlpha:0})

sim.createStageWalls();

 

makeLever(6 , 17.5, 9, "right", 0.7);

 

var circleA:QuickObject = sim.addCircle({x:2, y:3, radius:0.5, mass:4});

 

sim.addBox({x:15, y:12, width:2, height:0.5, density:0})

 

sim.addCircle({x:16, y:11, radius:0.5, mass:4, friction:0.2, fillColor:0});

 

sim.addBox({x:20.5, y:12, width:2, [...]

Posted in Box2D, QuickBox2D, motion | Tagged , , , , | 4 Comments

White Circles Black Circles

CLICK HERE TO COPY
Actionscript:

[SWF(backgroundColor=0xFFFFFF, width=500, height=500)]

 

var hsw:Number = stage.stageWidth / 2;

var hsh:Number = stage.stageHeight / 2;

var pointNum:int = 200;

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

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

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

var sorted:Array = [];

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

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

var colors:Vector.<uint> = new Vector.<uint>();

 

var pnt:Point = new Point();

var m:Matrix3D = new Matrix3D();

var v:Vector3D [...]

Posted in Uncategorized | Tagged , , | Leave a comment

Matrix Zoom and Pan

CLICK HERE TO COPY
Actionscript:

[SWF(width=600, height=600, frameRate=30)]

var sw:Number = stage.stageWidth;

var sh:Number = stage.stageHeight;

 

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

 

var scale:Number = 1;

var scaleDest:Number = 1;

var down:Boolean = false;

var dx:Number = 0, dy:Number = 0, time:Number = 0;

 

buttonMode = true;

 

addInstructions();

vectorTexture();

 

stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown);

stage.addEventListener(MouseEvent.MOUSE_UP, onUp);

addEventListener(Event.ENTER_FRAME, onLoop);

 

function addInstructions():void{

    var instruct:Sprite = Sprite(addChild(new Sprite()));

    with (instruct.graphics) beginFill(0x666666), drawRect(0,0,270, 30);

    instruct.x = [...]

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

Distance Spring

CLICK HERE TO COPY
Actionscript:

[SWF(backgroundColor=0x222222, width=500, height=500)]

var hsw:Number = stage.stageWidth / 2;

var hsh:Number = stage.stageHeight / 2;

var pointNum:int = 800

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

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

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

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

var sorted:Array = [];

var pnt:Point = new Point();

var m:Matrix3D = new Matrix3D();

var v:Vector3D = new Vector3D();

for (var i:int = 0; i<pointNum; [...]

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