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

PaperVision3D Cube Anime

Get Adobe Flash player
by ll_koba_ll 16 Feb 2009
package
{
    import flash.display.*;
    import flash.events.*;
    import org.papervision3d.lights.PointLight3D;
    import org.papervision3d.materials.utils.MaterialsList;
    import org.papervision3d.objects.primitives.*;
    import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
    import org.papervision3d.view.BasicView;
    import jp.progression.commands.*;

    [SWF(backgroundColor="0x000000", frameRate="30")]
    public class PV3DTest02 extends BasicView
    {
        private var cube:Cube;

        public function PV3DTest02()
        {
            super();

            var light:PointLight3D = new PointLight3D();
            
            var material:FlatShadeMaterial = new FlatShadeMaterial(light, 0xFFFFFF, 0x000000); 

            cube = new Cube(new MaterialsList({all:material}), 300 ,300, 300,1);
            scene.addChild(cube);
            anime();

            startRendering();
        }


        private function anime():void
        {
            var l:SerialList = new SerialList();
            l.addCommand(
                new DoTweener(cube, {
                    rotationZ:cube.rotationZ+Math.random()*100, 
                    rotationX:cube.rotationX+Math.random()*100,
                    rotationY:cube.rotationY+Math.random()*100,
                    time:1}),
                function():void {
                    anime();
                }
            );
            l.execute();
        }
    }
}