※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!

wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)

 notice: Flash editor updated! Join the development! Thanks to MiniBuilder


FORKED
  1. // forked from matsu4512's 燃えながら出てくる文字(修正版)
  2. package {
  3.     import __AS3__.vec.Vector;
  4.     
  5.     import flash.display.Bitmap;
  6.     import flash.display.BitmapData;
  7.     import flash.display.BlendMode;
  8.     import flash.display.Sprite;
  9.     import flash.display.StageAlign;
  10.     import flash.display.StageScaleMode;
  11.     import flash.events.Event;
  12.     import flash.events.TimerEvent;
  13.     import flash.geom.Matrix;
  14.     import flash.text.TextField;
  15.     import flash.text.TextFieldAutoSize;
  16.     import flash.text.TextFormat;
  17.     import flash.utils.Timer;
  18.     
  19.     [SWF(backgroundColor=0x000000, frameRate=30)]
  20.     public class String_Particle2 extends Sprite
  21.     {
  22.         //パーティクルを描写するBitmapData
  23.         public var canvas:BitmapData;
  24.         
  25.         private var fire_canvas:BitmapData;
  26.         
  27.         //テキストを描画するBitmapData
  28.         public var textCanvas:BitmapData;
  29.         
  30.         //パーティクルクラスのインスタンスを格納する配列
  31.         private var particles:Vector.<Particle>;
  32.         
  33.         private var circle_particles:Vector.<Circle_Particle>;
  34.         
  35.         private var timer:Timer;
  36.         
  37.         private const GRAVITY:Number = 0.1;
  38.         
  39.         private var count:int = 0;
  40.         
  41.         private var w:Number;
  42.         private var h:Number;
  43.         private var str:String;
  44.         private var fontSize:uint;
  45.         
  46.         public function String_Particle2(str:String="Every day is Carnival", fontSize:uint=40, w:Number=400, h:Number=100)
  47.         {
  48.             stage.scaleMode = StageScaleMode.NO_SCALE;
  49.             stage.align = StageAlign.TOP_LEFT;
  50.             
  51.             this.w = w;
  52.             this.h = h;
  53.             this.str = str;
  54.             this.fontSize = fontSize;
  55.             
  56.             
  57.             canvas = new BitmapData(w, h, false, 0x000000);
  58.             var bmp:Bitmap = new Bitmap(canvas);
  59.             bmp.x = stage.stageWidth / 2 - bmp.width / 2;
  60.             bmp.y = stage.stageHeight / 2 - bmp.height / 2;
  61.             addChild(bmp);
  62.             fire_canvas = new BitmapData(w, h, true);
  63.             var f_bmp:Bitmap = new Bitmap(fire_canvas);
  64.             f_bmp.x = stage.stageWidth / 2 - f_bmp.width / 2;
  65.             f_bmp.y = stage.stageHeight / 2 - f_bmp.height / 2;
  66.             addChild(f_bmp);
  67.             
  68.             start();    
  69.         }
  70.         
  71.         public function start():void{
  72.             init(str, fontSize);
  73.             
  74.             circle_particles = new Vector.<Circle_Particle>;
  75.             
  76.             timer = new Timer(33);
  77.             timer.addEventListener(TimerEvent.TIMER, loop);
  78.             timer.start();
  79.             
  80.             addEventListener(Event.ENTER_FRAME, effect_loop);
  81.         }
  82.         
  83.         private function init(str:String, size:uint):void{
  84.             var tf:TextField = new TextField;
  85.             tf.defaultTextFormat = new TextFormat("Swis721 BdRndBT", size, 0xFFFFFF );
  86.             tf.autoSize = TextFieldAutoSize.LEFT;
  87.             tf.text = str;
  88.             
  89.             //文字の描画
  90.             textCanvas = new BitmapData(tf.textWidth+10, tf.textHeight, false, 0x000000);
  91.             textCanvas.draw(tf);
  92.             particles = new Vector.<Particle>;
  93.             
  94.             createText();
  95.         }
  96.         
  97.         //文字からパーティクルの生成
  98.         private function createText():void{
  99.             //ステージを中心にテキストを配置するときの左上座標
  100.             var ofx:Number = w / 2 - textCanvas.width / 2;
  101.             var ofy:Number = h / 2 - textCanvas.height / 2;
  102.             
  103.             //textCanvasを1pxずつ見ていく
  104.             for(var ex:uint = 0; ex < textCanvas.width; ex++){
  105.                 for(var ey:uint = 0; ey < textCanvas.height; ey++){
  106.                     //textCanvasの座標(ex, ey)のRGB値の取得
  107.                     var c:uint = textCanvas.getPixel(ex, ey);
  108.                     if(c != 0x000000){
  109.                         var p:Particle = new Particle();
  110.                         p.x = ex;
  111.                         p.y = ey;
  112.                         p.c = c;
  113.                         particles.push(p);
  114.                     }
  115.                 }
  116.             }
  117.         }
  118.         
  119.         private function loop(event:TimerEvent):void{
  120.             //キャンパスをロック
  121.             canvas.lock();
  122.             
  123.             var cp:Circle_Particle;
  124.             
  125.             //パーティクルを描画
  126.             for(var i:int = 0; i < 15; i++){
  127.                 if(particles.length  <= count){
  128.                     timer.removeEventListener(TimerEvent.TIMER, loop);
  129.                     break;
  130.                 }
  131.                 canvas.setPixel(particles[count].x, particles[count].y, particles[count].c);
  132.                                if(count % 3 < 2){
  133.                              cp = new Circle_Particle(particles[count].x, particles[count].y, Math.random()*4-2, -Math.random()*5+1.5, Math.random()*2+1, Math.random()*0x00FFFF+ 0xFF0000);
  134.                         circle_particles.push(cp);
  135.                                 }
  136.                 count++;
  137.             }
  138.             
  139.             
  140.             //ロック解除
  141.             canvas.unlock();
  142.             
  143.         }
  144.         
  145.          private function func(item:Circle_Particle, index:int, vec:Vector.<Circle_Particle>):Boolean{
  146.             if(item.alpha <= 0){
  147.                 return false;
  148.             }
  149.             else 
  150.                 return true;
  151.         }
  152.         private function effect_loop(event:Event):void{
  153.             fire_canvas.fillRect(fire_canvas.rect, 0x000000);
  154.             circle_particles = circle_particles.filter(func);
  155.             var mtx:Matrix;
  156.             for each(var p:Circle_Particle in circle_particles){
  157.                 p.x  += p.vx;
  158.                 p.y += p.vy;
  159.                 p.vy += -GRAVITY;
  160.                 p.alpha -= 0.1;
  161.                 mtx = new Matrix();
  162.                 mtx.translate(p.x, p.y);
  163.                 fire_canvas.draw(p, mtx, null, BlendMode.ADD);
  164.                }
  165.         }
  166.     }
  167. }
  168. import flash.display.Shape;
  169. import flash.display.BlendMode;
  170. import flash.filters.BlurFilter;
  171.     
  172. class Particle{
  173.     public var x:Number;
  174.     public var y:Number;
  175.     public var ex:Number;
  176.     public var ey:Number;
  177.     public var c:int;
  178.     
  179.     public function Particle(){
  180.         x = 0;
  181.         y = 0;
  182.         ex = 0;
  183.         ey = 0;
  184.         c = 0;
  185.     }
  186. }
  187. class Circle_Particle extends Shape{
  188.     public var vx:Number;
  189.     public var vy:Number;
  190.     public var size:Number;
  191.     public var color:uint;
  192.     public function Circle_Particle(x:Number=0, y:Number=0, vx:Number=0, vy:Number=0, size:Number=5, color:uint=0xFFFFFF){
  193.         this.x = x;
  194.         this.y = y;
  195.         this.vx = vx;
  196.         this.vy = vy;
  197.         this.size = size;
  198.         this.color = color;
  199.         this.blendMode = BlendMode.ADD;
  200.         this.filters = [new BlurFilter(10101)];
  201.         graphics.beginFill(color);
  202.         graphics.drawCircle(00, size);
  203.         graphics.endFill();
  204.     }
  205. }
noswf
  1. // forked from matsu4512's 燃えながら出てくる文字(修正版)
  2. package {
  3.     import __AS3__.vec.Vector;
  4.     
  5.     import flash.display.Bitmap;
  6.     import flash.display.BitmapData;
  7.     import flash.display.BlendMode;
  8.     import flash.display.Sprite;
  9.     import flash.display.StageAlign;
  10.     import flash.display.StageScaleMode;
  11.     import flash.events.Event;
  12.     import flash.events.TimerEvent;
  13.     import flash.geom.Matrix;
  14.     import flash.text.TextField;
  15.     import flash.text.TextFieldAutoSize;
  16.     import flash.text.TextFormat;
  17.     import flash.utils.Timer;
  18.     
  19.     [SWF(backgroundColor=0x000000, frameRate=30)]
  20.     public class String_Particle2 extends Sprite
  21.     {
  22.         //パーティクルを描写するBitmapData
  23.         public var canvas:BitmapData;
  24.         
  25.         private var fire_canvas:BitmapData;
  26.         
  27.         //テキストを描画するBitmapData
  28.         public var textCanvas:BitmapData;
  29.         
  30.         //パーティクルクラスのインスタンスを格納する配列
  31.         private var particles:Vector.<Particle>;
  32.         
  33.         private var circle_particles:Vector.<Circle_Particle>;
  34.         
  35.         private var timer:Timer;
  36.         
  37.         private const GRAVITY:Number = 0.1;
  38.         
  39.         private var count:int = 0;
  40.         
  41.         private var w:Number;
  42.         private var h:Number;
  43.         private var str:String;
  44.         private var fontSize:uint;
  45.         
  46.         public function String_Particle2(str:String="心语难诉,但求一醉!", fontSize:uint=40, w:Number=400, h:Number=100)
  47.         {
  48.             stage.scaleMode = StageScaleMode.NO_SCALE;
  49.             stage.align = StageAlign.TOP_LEFT;
  50.             
  51.             this.w = w;
  52.             this.h = h;
  53.             this.str = str;
  54.             this.fontSize = fontSize;
  55.             
  56.             
  57.             canvas = new BitmapData(w, h, false, 0x000000);
  58.             var bmp:Bitmap = new Bitmap(canvas);
  59.             bmp.x = stage.stageWidth / 2 - bmp.width / 2;
  60.             bmp.y = stage.stageHeight / 2 - bmp.height / 2;
  61.             addChild(bmp);
  62.             fire_canvas = new BitmapData(w, h, true);
  63.             var f_bmp:Bitmap = new Bitmap(fire_canvas);
  64.             f_bmp.x = stage.stageWidth / 2 - f_bmp.width / 2;
  65.             f_bmp.y = stage.stageHeight / 2 - f_bmp.height / 2;
  66.             addChild(f_bmp);
  67.             
  68.             start();    
  69.         }
  70.         
  71.         public function start():void{
  72.             init(str, fontSize);
  73.             
  74.             circle_particles = new Vector.<Circle_Particle>;
  75.             
  76.             timer = new Timer(33);
  77.             timer.addEventListener(TimerEvent.TIMER, loop);
  78.             timer.start();
  79.             
  80.             addEventListener(Event.ENTER_FRAME, effect_loop);
  81.         }
  82.         
  83.         private function init(str:String, size:uint):void{
  84.             var tf:TextField = new TextField;
  85.             tf.defaultTextFormat = new TextFormat("Swis721 BdRndBT", size, 0xFFFFFF );
  86.             tf.autoSize = TextFieldAutoSize.LEFT;
  87.             tf.text = str;
  88.             
  89.             //文字の描画
  90.             textCanvas = new BitmapData(tf.textWidth+10, tf.textHeight, false, 0x000000);
  91.             textCanvas.draw(tf);
  92.             particles = new Vector.<Particle>;
  93.             
  94.             createText();
  95.         }
  96.         
  97.         //文字からパーティクルの生成
  98.         private function createText():void{
  99.             //ステージを中心にテキストを配置するときの左上座標
  100.             var ofx:Number = w / 2 - textCanvas.width / 2;
  101.             var ofy:Number = h / 2 - textCanvas.height / 2;
  102.             
  103.             //textCanvasを1pxずつ見ていく
  104.             for(var ex:uint = 0; ex < textCanvas.width; ex++){
  105.                 for(var ey:uint = 0; ey < textCanvas.height; ey++){
  106.                     //textCanvasの座標(ex, ey)のRGB値の取得
  107.                     var c:uint = textCanvas.getPixel(ex, ey);
  108.                     if(c != 0x000000){
  109.                         var p:Particle = new Particle();
  110.                         p.x = ex;
  111.                         p.y = ey;
  112.                         p.c = c;
  113.                         particles.push(p);
  114.                     }
  115.                 }
  116.             }
  117.         }
  118.         
  119.         private function loop(event:TimerEvent):void{
  120.             //キャンパスをロック
  121.             canvas.lock();
  122.             
  123.             var cp:Circle_Particle;
  124.             
  125.             //パーティクルを描画
  126.             for(var i:int = 0; i < 15; i++){
  127.                 if(particles.length  <= count){
  128.                     timer.removeEventListener(TimerEvent.TIMER, loop);
  129.                     break;
  130.                 }
  131.                 canvas.setPixel(particles[count].x, particles[count].y, particles[count].c);
  132.                                if(count % 3 < 2){
  133.                              cp = new Circle_Particle(particles[count].x, particles[count].y, Math.random()*4-2, -Math.random()*5+1.5, Math.random()*2+1, Math.random()*0x00FFFF+ 0xFF0000);
  134.                         circle_particles.push(cp);
  135.                                 }
  136.                 count++;
  137.             }
  138.             
  139.             
  140.             //ロック解除
  141.             canvas.unlock();
  142.             
  143.         }
  144.         
  145.          private function func(item:Circle_Particle, index:int, vec:Vector.<Circle_Particle>):Boolean{
  146.             if(item.alpha <= 0){
  147.                 return false;
  148.             }
  149.             else 
  150.                 return true;
  151.         }
  152.         private function effect_loop(event:Event):void{
  153.             fire_canvas.fillRect(fire_canvas.rect, 0x000000);
  154.             circle_particles = circle_particles.filter(func);
  155.             var mtx:Matrix;
  156.             for each(var p:Circle_Particle in circle_particles){
  157.                 p.x  += p.vx;
  158.                 p.y += p.vy;
  159.                 p.vy += -GRAVITY;
  160.                 p.alpha -= 0.1;
  161.                 mtx = new Matrix();
  162.                 mtx.translate(p.x, p.y);
  163.                 fire_canvas.draw(p, mtx, null, BlendMode.ADD);
  164.                }
  165.         }
  166.     }
  167. }
  168. import flash.display.Shape;
  169. import flash.display.BlendMode;
  170. import flash.filters.BlurFilter;
  171.     
  172. class Particle{
  173.     public var x:Number;
  174.     public var y:Number;
  175.     public var ex:Number;
  176.     public var ey:Number;
  177.     public var c:int;
  178.     
  179.     public function Particle(){
  180.         x = 0;
  181.         y = 0;
  182.         ex = 0;
  183.         ey = 0;
  184.         c = 0;
  185.     }
  186. }
  187. class Circle_Particle extends Shape{
  188.     public var vx:Number;
  189.     public var vy:Number;
  190.     public var size:Number;
  191.     public var color:uint;
  192.     public function Circle_Particle(x:Number=0, y:Number=0, vx:Number=0, vy:Number=0, size:Number=5, color:uint=0xFFFFFF){
  193.         this.x = x;
  194.         this.y = y;
  195.         this.vx = vx;
  196.         this.vy = vy;
  197.         this.size = size;
  198.         this.color = color;
  199.         this.blendMode = BlendMode.ADD;
  200.         this.filters = [new BlurFilter(10101)];
  201.         graphics.beginFill(color);
  202.         graphics.drawCircle(00, size);
  203.         graphics.endFill();
  204.     }
  205. }
noswf
  1. // forked from matsu4512's 燃えながら出てくる文字(修正版)
  2. package {
  3.     import __AS3__.vec.Vector;
  4.     
  5.     import flash.display.Bitmap;
  6.     import flash.display.BitmapData;
  7.     import flash.display.BlendMode;
  8.     import flash.display.Sprite;
  9.     import flash.display.StageAlign;
  10.     import flash.display.StageScaleMode;
  11.     import flash.events.Event;
  12.     import flash.events.TimerEvent;
  13.     import flash.geom.Matrix;
  14.     import flash.text.TextField;
  15.     import flash.text.TextFieldAutoSize;
  16.     import flash.text.TextFormat;
  17.     import flash.utils.Timer;
  18.     
  19.     [SWF(backgroundColor=0x000000, frameRate=30)]
  20.     public class String_Particle2 extends Sprite
  21.     {
  22.         //パーティクルを描写するBitmapData
  23.         public var canvas:BitmapData;
  24.         
  25.         private var fire_canvas:BitmapData;
  26.         
  27.         //テキストを描画するBitmapData
  28.         public var textCanvas:BitmapData;
  29.         
  30.         private var f_sp:Sprite;
  31.         
  32.         //パーティクルクラスのインスタンスを格納する配列
  33.         private var particles:Vector.<Particle>;
  34.         
  35.         //描画するパーティクルの数
  36.         private var p_num:int    
  37.         
  38.         //パーティクルを元の位置から移動させる最大距離
  39.         private var maxDis:int = 500;
  40.         
  41.         private var circle_particles:Vector.<Circle_Particle>;
  42.         
  43.         private var timer:Timer;
  44.         
  45.         public var sizeTo:Number=1;
  46.         
  47.         private const GRAVITY:Number = 0.1;
  48.         
  49.         private var count:int = 0;
  50.         
  51.         private var w:Number;
  52.         private var h:Number;
  53.         private var str:String;
  54.         private var fontSize:uint;
  55.         
  56.         public function String_Particle2(str:String="Every day is Carnival", fontSize:uint=40, w:Number=400, h:Number=100)
  57.         {
  58.             stage.scaleMode = StageScaleMode.NO_SCALE;
  59.             stage.align = StageAlign.TOP_LEFT;
  60.             
  61.             this.w = w;
  62.             this.h = h;
  63.             this.str = str;
  64.             this.fontSize = fontSize;
  65.             
  66.             
  67.             canvas = new BitmapData(w, h, false, 0x000000);
  68.             var bmp:Bitmap = new Bitmap(canvas);
  69.             bmp.x = stage.stageWidth / 2 - bmp.width / 2;
  70.             bmp.y = stage.stageHeight / 2 - bmp.height / 2;
  71.             addChild(bmp);
  72.             fire_canvas = new BitmapData(w, h, true);
  73.             var f_bmp:Bitmap = new Bitmap(fire_canvas);
  74.             f_bmp.x = stage.stageWidth / 2 - f_bmp.width / 2;
  75.             f_bmp.y = stage.stageHeight / 2 - f_bmp.height / 2;
  76.             addChild(f_bmp);
  77.             
  78.             f_sp = new Sprite;
  79.             
  80.             start();    
  81.         }
  82.         
  83.         public function start():void{
  84.             init(str, fontSize);
  85.             
  86.             circle_particles = new Vector.<Circle_Particle>;
  87.             
  88.             timer = new Timer(33);
  89.             timer.addEventListener(TimerEvent.TIMER, loop);
  90.             timer.start();
  91.             
  92.             addEventListener(Event.ENTER_FRAME, effect_loop);
  93.         }
  94.         
  95.         private function init(str:String, size:uint):void{
  96.             var tf:TextField = new TextField;
  97.             tf.defaultTextFormat = new TextFormat("Swis721 BdRndBT", size, 0xFFFFFF );
  98.             tf.autoSize = TextFieldAutoSize.LEFT;
  99.             tf.text = str;
  100.             
  101.             //文字の描画
  102.             textCanvas = new BitmapData(tf.textWidth+10, tf.textHeight, false, 0x000000);
  103.             textCanvas.draw(tf);
  104.             particles = new Vector.<Particle>;
  105.             
  106.             createText();
  107.         }
  108.         
  109.         //文字からパーティクルの生成
  110.         private function createText():void{
  111.             //ステージを中心にテキストを配置するときの左上座標
  112.             var ofx:Number = w / 2 - textCanvas.width / 2;
  113.             var ofy:Number = h / 2 - textCanvas.height / 2;
  114.             
  115.             //textCanvasを1pxずつ見ていく
  116.             for(var ex:uint = 0; ex < textCanvas.width; ex++){
  117.                 for(var ey:uint = 0; ey < textCanvas.height; ey++){
  118.                     //textCanvasの座標(ex, ey)のRGB値の取得
  119.                     var c:uint = textCanvas.getPixel(ex, ey);
  120.                     if(c != 0x000000){
  121.                         var p:Particle = new Particle();
  122.                         p.x = ex;
  123.                         p.y = ey;
  124.                         p.c = c;
  125.                         particles.push(p);
  126.                     }
  127.                 }
  128.             }
  129.         }
  130.         
  131.         private function loop(event:TimerEvent):void{
  132.             //キャンパスをロック
  133.             canvas.lock();
  134.             
  135.             var cp:Circle_Particle;
  136.             
  137.             //パーティクルを描画
  138.             for(var i:int = 0; i < 15; i++){
  139.                 if(particles.length  <= count){
  140.                     timer.removeEventListener(TimerEvent.TIMER, loop);
  141.                     break;
  142.                 }
  143.                 canvas.setPixel(particles[count].x, particles[count].y, particles[count].c);
  144.                                if(count % 3 < 2){
  145.                              cp = new Circle_Particle(particles[count].x, particles[count].y, Math.random()*4-2, -Math.random()*5+1.5, Math.random()*2+1, Math.random()*0x00FFFF+ 0xFF0000);
  146.                         circle_particles.push(cp);
  147.                                 }
  148.                 count++;
  149.             }
  150.             
  151.             
  152.             //ロック解除
  153.             canvas.unlock();
  154.             
  155.         }
  156.         
  157.          private function func(item:Circle_Particle, index:int, vec:Vector.<Circle_Particle>):Boolean{
  158.             if(item.alpha <= 0){
  159.                 return false;
  160.             }
  161.             else 
  162.                 return true;
  163.         }
  164.         private function effect_loop(event:Event):void{
  165.             fire_canvas.fillRect(fire_canvas.rect, 0x000000);
  166.             circle_particles = circle_particles.filter(func);
  167.             var mtx:Matrix;
  168.             for each(var p:Circle_Particle in circle_particles){
  169.                 p.x  += p.vx;
  170.                 p.y += p.vy;
  171.                 p.vy += -GRAVITY;
  172.                 p.alpha -= 0.1;
  173.                 mtx = new Matrix();
  174.                 mtx.translate(p.x, p.y);
  175.                 fire_canvas.draw(p, mtx, null, BlendMode.ADD);
  176.                }
  177.         }
  178.     }
  179. }
  180. import flash.display.Shape;
  181. import flash.display.BlendMode;
  182. import flash.filters.BlurFilter;
  183.     
  184. class Particle{
  185.     public var x:Number;
  186.     public var y:Number;
  187.     public var ex:Number;
  188.     public var ey:Number;
  189.     public var c:int;
  190.     
  191.     public function Particle(){
  192.         x = 0;
  193.         y = 0;
  194.         ex = 0;
  195.         ey = 0;
  196.         c = 0;
  197.     }
  198. }
  199. class Circle_Particle extends Shape{
  200.     public var vx:Number;
  201.     public var vy:Number;
  202.     public var size:Number;
  203.     public var color:uint;
  204.     public function Circle_Particle(x:Number=0, y:Number=0, vx:Number=0, vy:Number=0, size:Number=5, color:uint=0xFFFFFF){
  205.         this.x = x;
  206.         this.y = y;
  207.         this.vx = vx;
  208.         this.vy = vy;
  209.         this.size = size;
  210.         this.color = color;
  211.         this.blendMode = BlendMode.ADD;
  212.         this.filters = [new BlurFilter(10101)];
  213.         graphics.beginFill(color);
  214.         graphics.drawCircle(00, size);
  215.         graphics.endFill();
  216.     }
  217. }
noswf
Get Adobe Flash Player