In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Physics: Gravity Wells

Get Adobe Flash player
by bradsedito 19 Feb 2011
    Embed
/**
 * Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/aRiA
 */

package
{
  import org.flintparticles.twoD.emitters.Emitter2D;
  import org.flintparticles.twoD.renderers.PixelRenderer;

  import flash.display.Sprite;
  import flash.filters.BlurFilter;
  import flash.filters.ColorMatrixFilter;
  import flash.geom.Rectangle;

  [SWF(width='400', height='400', frameRate='60', backgroundColor='#000000')]

  public class Main extends Sprite
  {
    private var emitter:Emitter2D;
    
    public function Main()
    {
      emitter = new GravityWells();

      var renderer:PixelRenderer = new PixelRenderer( new Rectangle( 0, 0, 400, 400 ) );
      renderer.addFilter( new BlurFilter( 8, 8, 3 ) );
      renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.99,0 ] ) );
      renderer.addEmitter( emitter );
      addChild( renderer );
      
      emitter.start();
    }
  }
}

//////
//////  
  
  import org.flintparticles.common.counters.Blast;
  import org.flintparticles.common.initializers.ColorInit;
  import org.flintparticles.twoD.actions.GravityWell;
  import org.flintparticles.twoD.actions.Move;
  import org.flintparticles.twoD.emitters.Emitter2D;
  import org.flintparticles.twoD.initializers.Position;
  import org.flintparticles.twoD.zones.DiscZone;
  import flash.display.Sprite;
  import flash.events.MouseEvent;
  import flash.geom.Point;



  class GravityWells extends Emitter2D
  {
    public function GravityWells()
    {
      
      counter = new Blast( 500 );
      addInitializer( new ColorInit( 0xFFFFFFFF, 0xFFCCCCCC ) );
      addInitializer( new Position( new DiscZone( new Point( 200, 200 ), 400 ) ) );
    
      addAction( new Move() );
      addAction( new GravityWell( 200, 0, 200 ) );
      addAction( new GravityWell( 200, 200, 0 ) );
    }
  }
  
//////
//////