flash on 2010-9-15
♥0 |
Line 27 |
Modified 2010-09-15 11:23:00 |
MIT License
archived:2017-03-20 01:40:21
ActionScript3 source code
/**
* Copyright Makoto_Tanaka ( http://wonderfl.net/user/Makoto_Tanaka )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/nNGF
*/
package {
import flash.events.Event;
import org.papervision3d.view.BasicView;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.materials.*;
import org.papervision3d.materials.special.*;
public class FlashTest extends BasicView {
private var _sphere:Sphere;
private var _index:Number = 0;
// コンストラクタ
public function FlashTest() {
init();
}
// 初期化
protected function init():void {
// 球体の追加
var material:CompositeMaterial = new CompositeMaterial();
material.addMaterial( new ColorMaterial(0xffff00) );
material.addMaterial( new WireframeMaterial(0xff0000) );
_sphere = new Sphere(material, 300);
scene.addChild(_sphere);
// レンダリング開始
startRendering();
// 毎フレームごとのイベントを追加
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
// 毎フレームごとのイベント
// 球体を動かしブラーをかける
private function onEnterFrame(e:Event):void {
_sphere.z = Math.sin(_index) * 2000 + 2000;
_index += 0.05;
}
}
}