papervision3d no.1
♥0 |
Line 33 |
Modified 2011-08-24 22:21:38 |
MIT License
archived:2017-03-20 13:49:19
ActionScript3 source code
/**
* Copyright Nowloading_ ( http://wonderfl.net/user/Nowloading_ )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/40Ys
*/
package {
import org.papervision3d.materials.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.view.*;
import flash.events.Event;
[SWF(backgroundColor=0x000000)]
public class FlashTest extends BasicView {
private var sphere:Sphere;
private var n:int =10;
public function FlashTest() {
init();
}
private function init():void{
var mat:WireframeMaterial =
new WireframeMaterial(0xff0000,0.3,3);
mat.doubleSided = true;
sphere = new Sphere(mat, 300, 10, 10);
scene.addChild(sphere);
startRendering();
addEventListener(Event.ENTER_FRAME, loop);
}
private function loop(e:Event):void{
sphere.rotationY += 1;
sphere.rotationZ += 1;
sphere.z +=n;
if(sphere.z >= 250){
n = -10;
} else if(sphere.z <=-50){
n = 10;
}
}
}
}