Sample of ParticleField
...
@author ...
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import org.papervision3d.core.view.IView;
import org.libspark.thread.Thread;
import org.libspark.thread.EnterFrameThreadExecutor;
/**
* ...
* @author ...
*/
public class Pv3d011 extends Sprite
{
private var _view:CustomView;
public function Pv3d011()
{
addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
}
private function addedToStageHandler(e:Event):void
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.frameRate = 30;
_view = new CustomView();
addChild(_view);
}
}
}
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import org.papervision3d.view.BasicView;
import org.papervision3d.objects.special.ParticleField;
import org.papervision3d.materials.special.ParticleMaterial;
internal class CustomView extends BasicView {
private var bmpData:BitmapData;
private var pf:ParticleField;
public function CustomView() {
super(0, 0, true, true);
buildScene();
startRendering();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
private function enterFrameHandler(e:Event):void
{
pf.rotationX += 1;
pf.rotationY += 1;
}
protected function buildScene():void {
var mf:ParticleMaterial = new ParticleMaterial(0x0000ff, 1);
pf = new ParticleField(mf, 1000, 5, 1000, 1000, 1000);
scene.addChild(pf);
camera.x = 0;
camera.y = 0;
camera.z = -400;
}
}