forked from: forked from: PaperVision3D Cube Anime
// forked from dizgid's forked from: PaperVision3D Cube Anime
// forked from ll_koba_ll's PaperVision3D Cube Anime
package
{
import flash.display.*;
import flash.events.*;
import org.papervision3d.lights.PointLight3D;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
import org.papervision3d.view.BasicView;
import net.hires.debug.Stats;
[SWF(backgroundColor="0x000000", frameRate="60")]
public class PV3DTest02 extends BasicView
{
private var field:DisplayObject3D;
private var cube:Cube;
public function PV3DTest02()
{
super();
var light:PointLight3D = new PointLight3D();
light.y = 200;
field = new DisplayObject3D();
scene.addChild(field);
camera.y = 200;
var material:FlatShadeMaterial = new FlatShadeMaterial(light, 0xFFFFFF, 0x000000);
var size:Number = 80;
for(var i:int = 0; i < 20; i++){
cube = new Cube(new MaterialsList({all:material}), size ,size, size,1);
cube.x = (Math.random() - 0.5) * 800;
cube.y = (Math.random() - 0.5) * 800;
cube.z = (Math.random() - 0.5) * 800;
field.addChild(cube);
}
startRendering();
this.addEventListener(Event.ENTER_FRAME, _enterframeAct);
this.addChild(new Stats());
}
private function _enterframeAct(e:Event):void
{
field.rotationY += 0.5;
cube.rotationX += 5;
cube.rotationY += 5;
}
}
}