Skip to content

Instantly share code, notes, and snippets.

@itoz
Created February 29, 2012 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itoz/1938034 to your computer and use it in GitHub Desktop.
Save itoz/1938034 to your computer and use it in GitHub Desktop.
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