In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2013-4-9

Get Adobe Flash player
by shapevent 09 Apr 2013
    Embed
/**
 * Copyright shapevent ( http://wonderfl.net/user/shapevent )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/wnAl
 */

package {
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            
            
var matrix:Matrix3D = new Matrix3D();
var verts:Vector.<Number> = new Vector.<Number>();
var pVerts:Vector.<Number> = new Vector.<Number>();
var uvts:Vector.<Number> = new Vector.<Number>();
for (var i:Number = -2; i<2; i+=.02) {
    for (var j:Number = -2; j<2; j+=.02) {
        for (var k:Number = -2; k<2; k+=.02) {
            var s:Number = (i * i + 3) * (j * j + 3) * (k * k + 3) - 32 * (i *j *k + 1);
            if (s<0&&s>-.2) {
                verts.push(i * 100);
                verts.push(j * 100);
                verts.push(k * 100);
                pVerts.push(0),pVerts.push(0);
                uvts.push(0),uvts.push(0),uvts.push(0);
            }
        }
    }
}
var brush:BitmapData=new BitmapData(3,2,true,0x41FFFFFF);
var canvas:BitmapData=new BitmapData(400,400,false,0x000000);
addChild(new Bitmap(canvas));
var dx:Number=0;
var dy:Number=0;
addEventListener(Event.ENTER_FRAME, onLoop);
function onLoop(evt:Event):void {
    dx += (mouseX - dx)/4;
    dy += (mouseY - dy)/4;
    matrix.identity();
    matrix.appendRotation(dy,Vector3D.X_AXIS);
    matrix.appendRotation(dx,Vector3D.Y_AXIS);
    matrix.appendTranslation(200, 200, 0);
    Utils3D.projectVectors(matrix, verts, pVerts, uvts);
    canvas.lock();
    canvas.fillRect(canvas.rect, 0x000000);
    var p = new Point();
    for (var i:int = 0; i<pVerts.length; i+=2) {
        p.x = pVerts[i];
        p.y = pVerts[i+1];
        canvas.copyPixels(brush, brush.rect, p, null, null, true);
    }
    canvas.unlock();
}
            
        }
    }
}