Author Archives: Zevan

Vectorpark Style Cylinder

CLICK HERE TO COPY
Actionscript:

const TWO_PI:Number = Math.PI * 2;

const PI_HALF_PI:Number = Math.PI + Math.PI / 2;

x = stage.stageWidth / 2;

y = stage.stageHeight / 2;

var runCylinder:Function = makeCylinder(0,0, 100, 300, 0xFF0000, 0xFFCC00);

var dx:Number = 0;

var dy:Number = 0;

addEventListener(Event.ENTER_FRAME, onLoop);

function onLoop(evt:Event):void {

    dx += (mouseX / 50 - dx) / 4;

    dy += (mouseY - [...]

Posted in 3D, Graphics | Tagged , , | Leave a comment

Vectorpark Style Hemisphere

CLICK HERE TO COPY
Actionscript:

const TWO_PI:Number = Math.PI * 2;

const PI_HALF_PI:Number = Math.PI + Math.PI / 2;

x = stage.stageWidth / 2;

y = stage.stageHeight / 2;

 

var runHemisphere:Function = makeHemisphere(0,0, 100,0xFF0000, 0xFFCC00);

var dx:Number = 0;

var dy:Number = 0;

 

addEventListener(Event.ENTER_FRAME, onLoop);

function onLoop(evt:Event):void {

    dx += (mouseX / 50 - dx) / 4;

    dy += (mouseY - dy) / [...]

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

Drawing a Half-Circle

CLICK HERE TO COPY
Actionscript:

graphics.beginFill(0xFF0000);

halfCircle(graphics, 200,200, 100);

// original circle function by senocular (www.senocular.com) from here http://www.actionscript.org/forums/showthread.php3?s=&threadid=30328

function halfCircle(g:Graphics, x:Number,y:Number,r:Number):void {

    var c1:Number=r * (Math.SQRT2 - 1);

    var c2:Number=r * Math.SQRT2 / 2;

    g.moveTo(x+r,y);

    g.curveTo(x+r,y+c1,x+c2,y+c2);

    g.curveTo(x+c1,y+r,x,y+r);

    g.curveTo(x-c1,y+r,x-c2,y+c2);

    g.curveTo(x-r,y+c1,x-r,y);

    // comment in for full circle

    /*g.curveTo(x-r,y-c1,x-c2,y-c2);

    g.curveTo(x-c1,y-r,x,y-r);

    g.curveTo(x+c1,y-r,x+c2,y-c2);

  [...]

Posted in Graphics | Tagged , , | 3 Comments

Strange BitmapData Drawing Instructions

CLICK HERE TO COPY
Actionscript:

// instructions

var ins:Array = [0,

-1, 100, 200, 3, 100, 0, 50, 1, 100, -1, 100, 150, 0, 50,

-1, 160, 200, 0, 50, 3, 50, 2, 50, 3, 50, 0, 50,

-1, 220, 200, 0, 50, 3, 50, 2, 50, -1, 270, 150, 3, 50, 2, 50];

 

var canvas:BitmapData = new BitmapData(400,400,false, 0xCCCCCC);

addChild(new Bitmap(canvas));

 

var index:int [...]

Posted in misc, setPixel | Tagged , , | Leave a comment