Flash burning fire (flame effect with pure actionscript)

JUST 613 bytes in swf
  1. Open Flash 8,
  2. make new flash movie,
  3. insert the code below in actions for first frame (select frame, press F9, copy-paste code to the Actions pane)
  4. make rectangle with linear gradient fill, convert it to movieclip symbol (select and F8)
  5. having your new movieclip selected, press Ctrl+F3 to view it's properties
  6. type gradient_mc in "Instance name" field
  7. Hit Ctrl+Enter to see it
import flash.filters.*;
import flash.display.*;
//
var my_btm = new BitmapData(200, 200, true, 0xFFFFFF);
gradient_mc.start_offset = [];
gradient_mc.finish_offset = [];
var c = 0;
while (c<3) {
 gradient_mc.start_offset[c] = {x:0, y:0};
 gradient_mc.finish_offset[c] = {x:Math.random()*4-2, y:Math.random()*3+4};
 c++;
}
//
gradient_mc.onEnterFrame = function() {
 var c = 0;
 while (c<3) {
  this.start_offset[c].x += this.finish_offset[c].x;
  this.start_offset[c].y += this.finish_offset[c].y;
  c++;
 }
 //
 my_btm.perlinNoise(15, 50, 3, 5, false, false, 1, true, this.start_offset);
 var dmf = new DisplacementMapFilter(my_btm, new flash.geom.Point(0, 0), 1, 1, 10, 200, "clamp");
 this.filters = [dmf];
};

Copyrights and thanks to Kuzen

Related Posts by Categories



4 comments:

Anonymous said...

Hmm...

please check this one (borealis fire):

http://itoa.terror404.net/flash/index.html

Brian said...

How about an embedded example of this in action?

Anonymous said...

Very similar approach to one I created a while ago.
http://blog.audiotheory.co.uk/

Anonymous said...

Also check out http://www.pickatutorial.com for Flash and / or Actionscript tutorials.