Because the examples have a lot in common, we will first create a template class (based on the BookTemplateExample
), which we can reuse as a starting point for each example.
The template class for this chapter looks like this:
package { import flash.events.Event; import org.papervision3d.view.BasicView; import org.papervision3d.core.geom.Particles; import org.papervision3d.core.geom.renderables.Particle; public class ParticleTemplate extends BasicView { private var numberOfParticles:uint; private var easeOut:Number = 0.3 private var reachX:Number = 0.1 private var reachY:Number = 0.1 private var reachZ:Number = 0.5; public function ParticleTemplate() { super(stage.stageWidth,stage.stageHeight); stage.frameRate = 40; init(); startRendering(); } private function init():void { //code to be added numberOfParticles = 1000; for(var i:uint = 0; i < numberOfParticles; i++) { //code to be added } } private function randPos():Number { template classcreatingreturnMath...