forked from: Away3Dの練習
forked from Away3Dの練習 (diff: 19)
import away3d.primitives.Plane;
ActionScript3 source code
/**
* Copyright siouxcitizen ( http://wonderfl.net/user/siouxcitizen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/rKPA
*/
// forked from ser1zw's Away3Dの練習
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import away3d.containers.View3D;
import away3d.primitives.Plane;
//import away3d.primitives.Cube;
//import away3d.primitives.Sphere;
//import away3d.primitives.Trident;
[SWF(backgroundColor="#337777")]
public class HelloAway3D extends Sprite {
private var view:View3D;
private var plane:Plane;
//private var cube:Cube;
//private var sphere:Sphere;
public function HelloAway3D() {
view = new View3D();
view.x = stage.stageWidth >> 1;
view.y = stage.stageHeight >> 1;
addChild(view);
plane = new Plane({width: 70, height: 100});
//cube = new Cube({width: 80, height: 60});
//sphere = new Sphere({x: 100, y: 100, radius: 30});
view.scene.addChild(plane);
//view.scene.addChild(cube);
//view.scene.addChild(sphere);
//view.scene.addChild(new Trident(120, true));
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(e:Event):void {
view.scene.rotationX = -(stage.mouseY - (stage.stageHeight >> 1));
view.scene.rotationY = stage.mouseX - (stage.stageWidth >> 1);
plane.rotationX += 2;
plane.rotationY += 2;
//sphere.rotationX += 2;
//sphere.rotationY += 2;
view.render();
}
}
}
