Fork me on GitHub

Catherine Wheel

Flash required: You need version 10 or later of the free Flash player from Adobe to use this content. To download and install the free player from Adobe's web site click here.

This example uses an activity to rotate the emitter while it spits out particles.

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

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

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

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

      var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( 0, 0, 500, 500 ) );
      renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
      renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.97,0 ] ) );
      renderer.addEmitter( emitter );
      addChild( renderer );

      emitter.x = 250;
      emitter.y = 250;
      emitter.start( );
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.Fade;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.displayObjects.Line;
  import org.flintparticles.common.easing.Quadratic;
  import org.flintparticles.common.initializers.ColorInit;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.common.initializers.SharedImage;
  import org.flintparticles.twoD.actions.Accelerate;
  import org.flintparticles.twoD.actions.LinearDrag;
  import org.flintparticles.twoD.actions.Move;
  import org.flintparticles.twoD.activities.RotateEmitter;
  import org.flintparticles.twoD.emitters.Emitter2D;
  import org.flintparticles.twoD.initializers.Velocity;
  import org.flintparticles.twoD.zones.DiscSectorZone;

  import flash.geom.Point;

  public class CatherineWheel extends Emitter2D
  {
    public function CatherineWheel()
    {
      counter = new Steady( 200 );
      
      addActivity( new RotateEmitter( -7 ) );
      
      addInitializer( new SharedImage( new Line( 3 ) ) );
      addInitializer( new ColorInit( 0xFFFFFF00, 0xFFFF6600 ) );
      addInitializer( new Velocity( new DiscSectorZone( new Point( 0, 0 ), 250, 170, 0, 0.2 ) ) );
      addInitializer( new Lifetime( 1.3 ) );
      
      addAction( new Age( Quadratic.easeIn ) );
      addAction( new Move() );
      addAction( new Fade() );
      addAction( new Accelerate( 0, 50 ) );
      addAction( new LinearDrag( 0.5 ) );
    }
  }
}
import org.flintparticles.common.actions.Age;
import org.flintparticles.common.actions.Fade;
import org.flintparticles.common.counters.Steady;
import org.flintparticles.common.displayObjects.Line;
import org.flintparticles.common.easing.Quadratic;
import org.flintparticles.common.initializers.ColorInit;
import org.flintparticles.common.initializers.Lifetime;
import org.flintparticles.common.initializers.SharedImage;
import org.flintparticles.twoD.actions.Accelerate;
import org.flintparticles.twoD.actions.LinearDrag;
import org.flintparticles.twoD.actions.Move;
import org.flintparticles.twoD.activities.RotateEmitter;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.initializers.Velocity;
import org.flintparticles.twoD.renderers.BitmapRenderer;
import org.flintparticles.twoD.zones.DiscSectorZone;

var emitter:Emitter2D = new Emitter2D();

emitter.counter = new Steady( 200 );

emitter.addActivity( new RotateEmitter( -7 ) );

emitter.addInitializer( new SharedImage( new Line( 3 ) ) );
emitter.addInitializer( new ColorInit( 0xFFFFFF00, 0xFFFF6600 ) );
emitter.addInitializer( new Velocity( new DiscSectorZone( new Point( 0, 0 ), 250, 170, 0, 0.2 ) ) );
emitter.addInitializer( new Lifetime( 1.3 ) );

emitter.addAction( new Age( Quadratic.easeIn ) );
emitter.addAction( new Move() );
emitter.addAction( new Fade() );
emitter.addAction( new Accelerate( 0, 50 ) );
emitter.addAction( new LinearDrag( 0.5 ) );

var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( 0, 0, 500, 500 ) );
renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.97,0 ] ) );
renderer.addEmitter( emitter );
addChild( renderer );

emitter.x = 250;
emitter.y = 250;
emitter.start( );
<?xml version="1.0" encoding="utf-8"?>
<s:Application
  xmlns:fx="http://ns.adobe.com/mxml/2009" 
  xmlns:s="library://ns.adobe.com/flex/spark" 
  xmlns:f="http://flintparticles.org/2009/flint2d"
  xmlns:filters="flash.filters.*"
  width="500" height="500"
  backgroundColor="#000000">
  
<fx:Script>
  <![CDATA[
    import org.flintparticles.common.easing.Quadratic;
  ]]>
</fx:Script>

<f:BitmapRenderer id="renderer" width="500" height="500">
  <f:preFilters>
    <filters:BlurFilter blurX="2" blurY="2" quality="1"/>
    <filters:ColorMatrixFilter matrix="{[ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.97,0 ]}"/>
  </f:preFilters>
  <f:emitters>
    <f:Emitter id="emitter" autoStart="true" x="250" y="250">
      <f:counter>
        <f:Steady rate="200"/>
      </f:counter>
      <f:initializers>
        <f:ColorInit minColor="0xFFFFFF00" maxColor="0xFFFF6600"/>
        <f:Velocity>
          <f:DiscSectorZone centerX="0" centerY="0" innerRadius="170" outerRadius="250" minAngle="0" maxAngle="0.2"/>
        </f:Velocity>
        <f:SharedImage>
          <f:Line length="3"/>
        </f:SharedImage>
        <f:Lifetime lifetime="1.3"/>
      </f:initializers>
      <f:actions>
        <f:Move/>
        <f:Age easing="{Quadratic.easeIn}"/>
        <f:Fade/>
        <f:Accelerate x="0" y="50"/>
        <f:LinearDrag drag="0.5"/>
      </f:actions>
      <f:activities>
        <f:RotateEmitter angularVelocity="-7"/>
      </f:activities>
    </f:Emitter>
  </f:emitters>
</f:BitmapRenderer>
</s:Application>