Fork me on GitHub

Logo on Fire

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 a BitmapDataZone to create the fire in the same area as the logo. The fire effect is created from elliptical particles that fade in when they start and out again as they die and orient with their pointy end in the direction of motion.

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

  import flash.display.Bitmap;
  import flash.display.Sprite;
  import flash.geom.Rectangle;

  [SWF(width='500', height='200', frameRate='60', backgroundColor='#000000')]
  
  public class Main extends Sprite
  {
    private var emitter:Emitter2D;
    
    public function Main()
    {
      var bitmap:Bitmap = new Bitmap( new Logo( 265, 80 ) );
      addChild( bitmap );
      bitmap.x = 118;
      bitmap.y = 70;

      emitter = new LogoFire();

      var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( 0, 0, 500, 200 ) );
      renderer.addEmitter( emitter );
      addChild( renderer );
      
      emitter.x = 118;
      emitter.y = 70;
      emitter.start( );
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.ColorChange;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.easing.TwoWay;
  import org.flintparticles.common.initializers.ImageClass;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.twoD.actions.Accelerate;
  import org.flintparticles.twoD.actions.LinearDrag;
  import org.flintparticles.twoD.actions.Move;
  import org.flintparticles.twoD.actions.RotateToDirection;
  import org.flintparticles.twoD.emitters.Emitter2D;
  import org.flintparticles.twoD.initializers.Position;
  import org.flintparticles.twoD.initializers.Velocity;
  import org.flintparticles.twoD.zones.BitmapDataZone;
  import org.flintparticles.twoD.zones.DiscSectorZone;

  import flash.display.BitmapData;
  import flash.geom.Point;

  public class LogoFire extends Emitter2D
  {
    public function LogoFire()
    {
      counter = new Steady( 600 );
      
      addInitializer( new Lifetime( 0.8 ) );
      addInitializer( new Velocity( new DiscSectorZone( new Point( 0, 0 ), 10, 5, -Math.PI * 0.75, -Math.PI * 0.25 ) ) );
      var bitmap:BitmapData = new Logo( 265, 80 );
      addInitializer( new Position( new BitmapDataZone( bitmap ) ) );
      addInitializer( new ImageClass( FireBlob ) );
      
      addAction( new Age( TwoWay.quadratic ) );
      addAction( new Move() );
      addAction( new LinearDrag( 1 ) );
      addAction( new Accelerate( 0, -20 ) );
      addAction( new ColorChange( 0xFFFF9900, 0x00FFDD66 ) );
      addAction( new ScaleImage( 1.4, 2 ) );
      addAction( new RotateToDirection() );
    }
  }
}


import org.flintparticles.common.debug.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.common.displayObjects.RadialDot;
import org.flintparticles.common.initializers.*;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.initializers.*;
import org.flintparticles.twoD.renderers.*;
import org.flintparticles.twoD.zones.*;  
import org.flintparticles.common.easing.TwoWay;

var bitmapData:BitmapData = new Logo( 265, 80 );
var bitmap:Bitmap = new Bitmap( new Logo( 265, 80 ) );
bitmap.bitmapData = bitmapData;
addChild( bitmap );
bitmap.x = 118;
bitmap.y = 70;

var emitter:Emitter2D = new Emitter2D();
emitter.counter = new Steady( 600 );

emitter.addInitializer( new Lifetime( 0.8 ) );
emitter.addInitializer( new Velocity( new DiscSectorZone( new Point( 0, 0 ), 10, 5, -Math.PI * 0.75, -Math.PI * 0.25 ) ) );
emitter.addInitializer( new Position( new BitmapDataZone( bitmapData ) ) );
emitter.addInitializer( new ImageClass( FireBlob ) );

emitter.addAction( new Age( TwoWay.quadratic ) );
emitter.addAction( new Move() );
emitter.addAction( new Accelerate( 0, -20 ) );
emitter.addAction( new ColorChange( 0xFFFF9900, 0x00FFDD66 ) );
emitter.addAction( new ScaleImage( 1.4, 2.0 ) );
emitter.addAction( new RotateToDirection() );

var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( 0, 0, 500, 200 ) );
renderer.addEmitter( emitter );
addChild( renderer );

emitter.x = 118;
emitter.y = 70;
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"
  width="500" height="200"
  backgroundColor="#000000">
  
<fx:Script>
  <![CDATA[
    import org.flintparticles.common.easing.TwoWay;
  ]]>
</fx:Script>

<s:BitmapImage source="{new Logo( 265, 80 )}" width="265" height="80" x="118" y="70"/>
<f:BitmapRenderer id="renderer" width="500" height="200">
  <f:emitters>
    <f:Emitter id="emitter" autoStart="true" x="118" y="70">
      <f:counter>
        <f:Steady rate="600"/>
      </f:counter>
      <f:initializers>
        <f:Position>
          <f:BitmapDataZone bitmapData="{new Logo( 265, 80 )}"/>
        </f:Position>
        <f:Velocity>
          <f:DiscSectorZone centerX="0" centerY="0" innerRadius="5" outerRadius="10" minAngle="{-Math.PI * 0.75}" maxAngle="{-Math.PI * 0.25}"/>
        </f:Velocity>
        <f:ImageClass imageClass="{FireBlob}"/>
        <f:Lifetime lifetime="0.8"/>
      </f:initializers>
      <f:actions>
        <f:Move/>
        <f:Age easing="{TwoWay.quadratic}"/>
        <f:LinearDrag drag="1"/>
        <f:Accelerate x="0" y="-20"/>
        <f:ColorChange startColor="0xFFFF9900" endColor="0x00FFDD66"/>
        <f:ScaleImage startScale="1.4" endScale="2"/>
        <f:RotateToDirection/>
      </f:actions>
    </f:Emitter>
  </f:emitters>
</f:BitmapRenderer>
</s:Application>