/examples3D/BrownianMotion/Away3d4/Main.as

https://github.com/404Assassin/Flint-examples
ActionScript | 76 lines | 35 code | 12 blank | 29 comment | 0 complexity | 61b3aa9bda0be1d5ae47adee54873386 MD5 | raw file
  1. /*
  2. * FLINT PARTICLE SYSTEM
  3. * .....................
  4. *
  5. * Author: Richard Lord
  6. * Copyright (c) Richard Lord 2008-2011
  7. * http://flintparticles.org/
  8. *
  9. * Licence Agreement
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12. * of this software and associated documentation files (the "Software"), to deal
  13. * in the Software without restriction, including without limitation the rights
  14. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. * copies of the Software, and to permit persons to whom the Software is
  16. * furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be included in
  19. * all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27. * THE SOFTWARE.
  28. */
  29. package
  30. {
  31. import away3d.containers.ObjectContainer3D;
  32. import away3d.containers.View3D;
  33. import org.flintparticles.integration.away3d.v4.A3D4Renderer;
  34. import org.flintparticles.threeD.emitters.Emitter3D;
  35. import flash.display.Sprite;
  36. import flash.events.Event;
  37. [SWF(width='400', height='400', frameRate='60', backgroundColor='#000000')]
  38. public class Main extends Sprite
  39. {
  40. private var emitter:Emitter3D;
  41. private var view:View3D;
  42. private var renderer:A3D4Renderer;
  43. public function Main()
  44. {
  45. emitter = new BrownianMotion( stage );
  46. view = new View3D();
  47. view.width = 400;
  48. view.height = 400;
  49. addChild( view );
  50. var particleContainer:ObjectContainer3D = new ObjectContainer3D();
  51. view.scene.addChild( particleContainer );
  52. particleContainer.z = -200;
  53. renderer = new A3D4Renderer( particleContainer );
  54. renderer.addEmitter( emitter );
  55. emitter.start();
  56. addEventListener( Event.ENTER_FRAME, render, false, 0, true );
  57. }
  58. private function render( ev:Event ):void
  59. {
  60. // render the view
  61. view.render();
  62. }
  63. }
  64. }