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

[1日1Wonderfl] 5日目:KAGE - BUNSHINE

Lightwave3Dからアニメーション付きのColladaファイルを書き出すよ
手順はここにメモっておきましたー → http://www.ahiru.org/archives/135
1日1Wonderfl 4/30日目
もやってみた
1日1Wonderfl 5/30日目
KAGE - BUNSHINE
// forked from yd_niku's [1日1Wonderfl] 4日目:アニメーション付きColladaにエフェクトをかけてみる
// forked from mariot's forked from: Lightwave3Dからアニメーション付きColladaを書き出すよ
// forked from noenoe's Lightwave3Dからアニメーション付きColladaを書き出すよ
// Lightwave3Dからアニメーション付きのColladaファイルを書き出すよ
// 手順はここにメモっておきましたー → http://www.ahiru.org/archives/135

// 1日1Wonderfl 4/30日目
// もやってみた

// 1日1Wonderfl 5/30日目
// KAGE - BUNSHINE 
package {
	import flash.events.Event;
        import flash.display.*;
        import flash.geom.*;
        import flash.filters.*;
	
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.objects.parsers.DAE;
	import org.papervision3d.view.BasicView;
        import org.papervision3d.lights.PointLight3D;
        import org.papervision3d.materials.shaders.CellShader;
        import org.papervision3d.materials.ColorMaterial;
        import org.papervision3d.materials.shaders.ShadedMaterial;
        import org.papervision3d.materials.utils.MaterialsList;
        import org.papervision3d.materials.BitmapMaterial;

	public class Lightwave2Collada extends Sprite
	{
		public var dae:DAE;
		public var target:DisplayObject3D;
		public var view:BasicView;
		public var light:PointLight3D;

                private var _tmp:BitmapData;
                private var _canvas :BitmapData;

		public function Lightwave2Collada()
		{
                        _tmp= new BitmapData( stage.stageWidth, stage.stageHeight, true, 0x00FFFFFF );
                        _canvas = new BitmapData( stage.stageWidth, stage.stageHeight, false, 0xFFFFFF00 );
                        addChild( new Bitmap( _canvas) );
                        
			view = new BasicView();
			this.addChild(view);


                        
                        // Create a new PointLight3d object
                        // PointLight3D(showLight:Boolean = false, flipped:Boolean = false)
                        light = new PointLight3D(true, true);
                        view.scene.addChild(light);
                        light.y = 800;
                        light.x = 500;
                        
			// Create a new dae object. dae was transrated from Lightwave fromat
                        // DAE(autoPlay:Boolean = true, name:String = null, loop:Boolean = false)
			dae = new DAE(true,null,true);
			dae.scale = 200;
			dae.load("http://www.ahiru.org/works/pv3d/colladaExport/sampleSwf/export.dae");
			view.scene.addChild(dae);

                        //target.replaceMaterialByName(cellShaderMat, "all");
			
			// Setting the camera
			target = new DisplayObject3D();
			target.y = 400;
			view.scene.addChild(target);

			view.camera.y = 800;
			view.camera.target = target;

			stage.addEventListener(Event.ENTER_FRAME, _enterFrameHandler)
		}

                private var filter1:BitmapFilter = new ColorMatrixFilter( [ 0.98, 0, -0.2, 0, 0,   0, 0.95, 0, 0, 0,   0, 0, 0.9, 0, 0,   0, 0, 0, 1, 0 ] );
		private var filter2:BitmapFilter = new BlurFilter(8,8,1);
                private var op:Point =new Point(0,0);
		private function _enterFrameHandler(e:Event):void{
                        _canvas.fillRect( _canvas.rect, 0x00FFFFFF  );
                        _tmp.fillRect( _tmp.rect, 0x00FFFFFF );
                        _tmp.draw( view );
                        
                        var rect:Rectangle =_tmp.getColorBoundsRect(0xFF000000, 0x00, false );
                        //_canvas.fillRect( rect, 0xFFFF0000 );
                        //trace(Math.floor( rect.width), int(rect.height) );
                         var chara:BitmapData =new BitmapData( 200, 200, true, 0x00 );
                         
                         for( var i :int=3; i > 0; --i ) {
                             var scale :Number =Math.pow( 0.8, i );
                             var dscale :Number =1-scale;
                             chara.fillRect( chara.rect, 0x00 );
                             chara.draw( _tmp, new Matrix( scale,0, 0,scale,-rect.x*scale, -rect.y*scale), new ColorTransform( 8, 0.5, 0.3, 1, dscale*255, dscale*255, dscale*255) );
                             for( var j:int = 0; j<4; ++j ) {
                                 _canvas.draw( chara, new Matrix( 1, 0, 0, 1, j*120, i*-24+130 ) );
                             }
                             _canvas.applyFilter( _canvas, _canvas.rect, new Point(), new BlurFilter( i*4, i*4, 1 ) );
                         }
     
			dae.rotationY += 3;
			view.startRendering();

                        
		}
	}
}