2009年 07月 28日
package
{
import away3d.cameras.Camera3D;
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.lights.DirectionalLight3D;
import away3d.loaders.TTF;
import away3d.loaders.data.FontData;
import away3d.materials.PhongColorMaterial;
import away3d.materials.ShadingColorMaterial;
import away3d.materials.WireColorMaterial;
import away3d.primitives.Sphere;
import away3d.primitives.TextField3D;
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.ByteArray;
[SWF(backgroundColor="#000000", frameRate="60", quality="LOW", width="600", height="400")]
public class Away3D_Logo extends Sprite
{
[Embed(source="../assets/arial.ttf", mimeType="application/octet-stream")]
private var ArialEmbedded:Class;
//エンジン用 メンバ変数
private var _scene:Scene3D;
private var _camera:Camera3D;
private var _view:View3D;
private var _object3D:TextField3D;
/**----------------------------------------------------
* Away3D_Logo
----------------------------------------------------*/
public function Away3D_Logo()
{
super();
this._init();
}
/**----------------------------------------------------
* _init
----------------------------------------------------*/
private function _init():void
{
this._scene = new Scene3D();
this._camera = new Camera3D({zoom:10, focus:100, x:0, y:0, z:-5000});
this._view = new View3D({scene:this._scene, camera:this._camera});
this.addChild( this._view );
var rawData:ByteArray = new ArialEmbedded();
var fontdata:FontData = TTF.parse(rawData,"abcdefghijklmnopqrstvvwxyzABCDEFGHIJKLMNOPQRSTVVWXYZ!?");
var textfield:TextField3D = new TextField3D("Belcro.NET", fontdata, {textSize:60, textSpacing:0});
textfield.material = new WireColorMaterial(0xE2E2E2);
textfield.extrudeMaterial = new WireColorMaterial(0xEC008C);
textfield.extrude(100);
this._object3D = textfield;
this._scene.addChild( this._object3D );
//イベントを作成
this.addEventListener( Event.ENTER_FRAME, this._enterframe_Event );
this.addEventListener( Event.RESIZE, this._resize_Event );
//リサイズイベントを実行
this._resize_Event(null);
}
/**----------------------------------------------------
* _enterframe_Event
----------------------------------------------------*/
private function _enterframe_Event( evn:Event ):void
{
this._object3D.rotationX += 1.2;
this._object3D.rotationY += 1.1;
this._view.render();
}
/**----------------------------------------------------
* _resize_Event
----------------------------------------------------*/
private function _resize_Event(evn:Event):void
{
this._view.x = stage.stageWidth / 2;
this._view.y = stage.stageHeight / 2;
}
}
}
投稿者: d5 18 : 07
更新日:2009-07-28 18:20:43
|
|
|
| |