Created
February 29, 2012 05:08
-
-
Save itoz/1938034 to your computer and use it in GitHub Desktop.
Away3D 4.0 beta 立方体をくるくる回す、ベーシックサンプル。 ref: http://qiita.com/items/2891
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* copyright (c) 2012 itoz.jp | |
* @auther itoz | |
*/ | |
package | |
{ | |
import away3d.cameras.Camera3D; | |
import away3d.containers.Scene3D; | |
import away3d.containers.View3D; | |
import away3d.entities.Mesh; | |
import away3d.materials.ColorMaterial; | |
import away3d.primitives.CubeGeometry; | |
import flash.display.Sprite; | |
import flash.events.Event; | |
[SWF(backgroundColor="#FFFFFF", frameRate="60", width="800", height="600")] | |
/** | |
* Away3D 4.0 beta 立方体をくるくる回す、ベーシックサンプル。 | |
* 動作サンプル | |
* @see http://dl.dropbox.com/u/958512/sample/away3d4/basicSample/index.html | |
*/ | |
public class BasicSample extends Sprite | |
{ | |
private var _view : View3D; | |
private var _scene : Scene3D; | |
private var _camera : Camera3D; | |
private var _cubeGeo : CubeGeometry; | |
private var _cube : Mesh; | |
public function BasicSample() | |
{ | |
_view = addChild(new View3D()) as View3D; | |
_view.antiAlias = 4; | |
_view.backgroundColor = 0xa1c3c0; | |
_scene = _view.scene; | |
_camera = _view.camera; | |
var material : ColorMaterial = new ColorMaterial( 0x56a0b6); | |
_cubeGeo = new CubeGeometry(256, 256, 256, 4, 4, 4); | |
_cube = new Mesh(_cubeGeo, material); | |
_scene.addChild(_cube); | |
addEventListener(Event.ENTER_FRAME, update); | |
} | |
private function update(event : Event) : void | |
{ | |
_cube.rotationY += 4; | |
_view.render(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment