Skip to content

Instantly share code, notes, and snippets.

@itoz itoz/BasicSample.as
Created Feb 29, 2012

Embed
What would you like to do?
Away3D 4.0 beta 立方体をくるくる回す、ベーシックサンプル。 ref: http://qiita.com/items/2891
/**
* 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
You can’t perform that action at this time.